We've looked at two styles of configuration scripts and at how to construct PHP code to process them. But by no means are these the only formats for a configuration file!
A configuration file's format essentially depends the programmer's style and how he or she struck the balance between easy maintenance by users and easy interpretation by the program.
For practice and to expand on the examples discussed here, you may wish to write code that will parse more complex configuration files. An example would be one similar to a configuration file for Apache where directives may be grouped and can take more than one value. Feel free to explore other configuration file setups and find the one that works best for you.
Timothy Boronczyk lives in Syracuse, NY, where he works as an E-Services Coordinator for a local credit union. He has a background in elementary education, over 5 years experience in web design and has written tutorials on web design, PHP, Ruby, XML and various other topics. His hobbies include photography and composing music.
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |