views:

37

answers:

1

How do you output an array with FirePHP?

I'm using FirePHP in a Zend Framework project. I can output the value of individual variables with:

$logger->log('foo = '.$foo, Zend_Log::INFO);

and see something like:

foo = "Ponies!"

However if $foo is an array I only see:

foo = Array

and the word Array is not clickable or hoverable or anything.

I googled Google and my googling didn't return anything about how to output the values in an array with FirePHP. Any ideas?

+3  A: 

It doesn't have much to do with FirePHP, it's because you're concatenating the array to a string: 'foo = '.$foo. At this point PHP has to cast the array to a string, which results in the string "Array". If you'd just do $logger->log($foo), the array would probably be expanded automatically (depending on how intelligent the logger class is, most do this kind of thing).

If you need to expand the array manually, use var_export($foo, true).

deceze
And that did it. I didn't even consider that concatenating the array to a string would cast it as such. Makes sense but I just glossed right over that, mentally. Thanks!
gaoshan88