bman bman - 1 year ago 142
PHP Question

How to load return array from a PHP file?

I have a PHP file a configuration file coming from a Yii message translation file which contains this:

return array(
'key' => 'value'
'key2' => 'value'

I want to load this array from another file and store it in a variable

I tried to do this but it doesn't work

function fetchArray($in)

is the filename of the PHP file

Any thoughts how to do this?

Answer Source

When an included file returns something, you may simply assign it to a variable

$myArray = include $in;


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download