开发者

PHP: why do I get "Array" instead of its content

When I want to print the content of an Array, I always get the strin开发者_如何学Cg "Array" instead of the content.

I've also tried: implode(",", $myArray);

but still I get "Array" rather than the content itself


Use print_r() to recursively print arrays.


implode() takes a maximum of two arguments:

 string implode ( string $glue , array $pieces )

Try var_dump(), var_export() or print_r() instead:

var_dump($myArray);
var_export($myArray);
print_r($myArray);


var_dump($theArray);

This prints out the array in nice tabbed format, with both the keys / indices, value types and values shown.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜