PHP dump variable as PHP code

gaolinjcp

New Member
I'm looking for a function to dump a multi-dimension array so that the output is valid php code.Suppose I have the following array:\[code\]$person = array();$person['first'] = 'Joe';$person['last'] = 'Smith';$person['siblings'] = array('Jane' => 'sister', 'Dan' => 'brother', 'Paul' => 'brother');\[/code\]Now I want to dump the $person variable so the the dump string output, if parsed, will be valid php code that redefines the $person variable.So doing something like:\[code\]dump_as_php($person);\[/code\]Will output:$person = array('first' => 'Joe', 'last' => 'Smith', 'siblings' => array('Jane' => 'sister', 'Dan' => 'brother', 'Paul' => 'brother'));
 
Back
Top