I have a need to print a complex PHP variable that can be pasted into code directly. print_r
doesn't do it as when I use it, I get something like this:
Array
(
[cost] => 218.16
[discount] => Array(...)
[description] => Cost Not Included
[quantity] => 1
)
which cannot be immediately pasted into PHP code. I instead need something like so (with commas added, brackets changes to ampersands, etc)
array
(
'cost' => '218.16',
'discount' => array(...),
'description' => 'Cost Not Included',
'quantity' => 1,
),
How?
Currently I do it manually in my text editing program...