开发者

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

开发者 https://www.devze.com 2023-01-26 09:04 出处:网络
When I want to print the content of an Array, I always get the strin开发者_如何学Cg \"Array\" instead of the 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

精彩评论

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