When working with a PHP script, sometimes it's just easier to have some of the configuration options outside of the souce. Not only does this make things a bit more friendly for the user, but it makes less debugging for you in the long run. But, to harness this feature, you might need a shove in the right direction - and that's where this new article comes in.
In this new piece from Codewalkers, Configuration File Processing with PHP, the author steps you through two different types of config files - simple and grouped - and shows you how you can take a few simple lines of PHP code to grab the file, parse it, and return the contents and the delimiter. The grouped config file also has the added benefit of having its values returned in an easy-to-use array.
The parse_ini() function comes pretty close to doing what the second example shows, but doesn't give the flexiblilty that this code offers. Parsing config files can be a nice feature, but also be careful that you don't dump too much into it, making it more complex that parts of the application itself...




