3

Hi all I have the ChromePhp logging extension set up with PhpConsole and it's working fine.

But the usual ChromePhp::log("Variable value: ".$variable) doesn't like having $variable as an array. It throws an array to string conversion error.

Is there an in-built method to log the array in human readable format, just like javascript's console.log(array). Or is it a case of iterating over the array and passing each index and value.

Kyohei Kaneko
  • 932
  • 2
  • 8
  • 25

1 Answers1

2

Ah easy sorry I got it. I just need to split it into two logs.

ChromePhp::log("Array contents: ");
ChromePhp::log($array);

This prints to the console as expected in human readable format.

You cant concatenate an array onto a string in the logger.

Kyohei Kaneko
  • 932
  • 2
  • 8
  • 25