Currently I can able to create constant variable in Codeigniter, but is there any way to create constant array in CI. Suppose I can create constant array of Languages supported by my website.
$language = array('English', 'French');
Currently I can able to create constant variable in Codeigniter, but is there any way to create constant array in CI. Suppose I can create constant array of Languages supported by my website.
$language = array('English', 'French');
In your constants.php located in your application/config folder simply declare it as
defined('LANGUAGE') OR define('LANGUAGE', array('English', 'French'));
Use can use them as
foreach (LANGUAGE as $key => $value) {
echo $value;
}
in your config->constants.php
$config['language'] = 'english';
$config['language'] = 'french';