Posts tagged with: zend-config

How to Specify Non-String PHP Data Types in Zend Config XML and INI Files

Zend Config INI and Zend Config XML are adapters in the Zend Framework that allow you to store your application or website configuration data (such as database connector information and salt values) in an easy to interpret text file (I happen to prefer INI files over XML because INI is more terse).

The biggest downside to these files is that they don’t store PHP data types or values like NULL, FALSE, or TRUE, and you can’t specify an int, double, or float, the adapters only return strings.

Here is the recursive code for converting all your values:

Here is how I use it in my Bootstrap.php file in my Zend Framework application:

The following config file will end up looking like the following array (before turning it into a Zend_Config object)