I have a function that spits out an array using print_r
and would like to capture the information inside a variable to input it into a function for a specific use case. I've simplified the output to make it easier to understand.
[fruit] => 'banana'
[color] => 'yellow'
[sizes] => array('small', 'medium')
I would like it formatted as so:
$var = 'fruit' => 'banana', 'color' => 'yellow', 'sizes' => array('small', 'medium');
This way I can copy and paste the output of the first and assign it to a new default variable.