cakephp log an array as var_dump
Just use print_r, it accepts a second argument not to output the result.
CakeLog::write('debug', 'myArray'.print_r($myArray, true) );
And if you don't want new lines, tabs or double spaces in your log files:
$log = print_r($myArray, true);$log = str_replace(array("\n","\t"), " ", $log);$log = preg_replace('/\s+/', ' ',$log);CakeLog::write('debug', 'myArray' . $log);
Try:
CakeLog::write('debug', 'myArray'.print_r($myArray, true));
The true
parameter makes print_r return the value rather than print on screen, so you can save it.