Verification: a143cc29221c9be0

Notice array to string conversion in registry php

What the PHP Notice means and how to reproduce it:

If you send a PHP array into a function that expects a string like: echo or print, then the PHP interpreter will convert your array to the literal string Array, throw this Notice and keep going. For example:

php> print(array(1,2,3))

PHP Notice:  Array to string conversion in 
/usr/local/lib/python2.7/dist-packages/phpsh/phpsh.php(591) :
eval()'d code on line 1

In this case, the function print dumps the literal string: Array to stdout and then logs the Notice to stderr and keeps going.

Another example in a PHP script:

Correction 1: use foreach loop to access array elements

$stuff = array(1,2,3);
foreach ($stuff as $value) {
    echo $value, "\n";



Or along with array keys

$stuff = array('name' => 'Joe', 'email' => '');
foreach ($stuff as $key => $value) {
    echo "$key: $value\n";


name: Joe

Note that array elements could be arrays as well. In this case either use foreach again or access this inner array elements using array syntax, e.g. $row['name']

Correction 2: Joining all the cells in the array together:

In case it's just a plain 1-demensional array, you can simply join all the cells into a string using a delimiter:

Correction 3: Stringify an array with complex structure:

In case your array has a complex structure but you need to convert it to a string anyway, then use

$stuff = array('name' => 'Joe', 'email' => '');
print json_encode($stuff);