NYCPHP Meetup

NYPHP.org

[nycphp-talk] Readini

Rob Marscher rmarscher at beaffinitive.com
Fri Dec 14 23:19:31 EST 2007


On Dec 14, 2007, at 4:06 PM, Gary Mort wrote:
> I'm curious, is there a reason readini is not used for config files  
> in general?
> Is it that much faster to include the config.php file as opposed to  
> using readini?

You mean parse_ini_file, right? http://php.net/parse_ini_file

Ini files are more readable than php... but sometimes I think it's  
nice to have the flexibility of php in my config files to be able to  
put a little php in them... I guess what I'm thinking it more akin to  
the bootstrap file concept.

Parse_ini_file is part of the core php code, so it's probably pretty  
fast.  A pure PHP implementation would surely be too slow.  I would  
guess the performance difference with parse_ini_file (if significant)  
isn't reason enough to not use it if you prize readability... then  
again... maybe it's worth taking it one step farther and installing  
syck and the pecl ext/syck extension so you can read/write YAML:
http://www.whytheluckystiff.net/syck/
http://devzone.zend.com/article/2585-Using-YAML-With-PHP-and-PECL






More information about the talk mailing list