I have searched SO but couldn\'t find an answer.My PHP script is receiving some JSON by http post that looks like this:
{
\"task\": [
{
\"task_id\": \"3\",
Try echo count($task_array['task']);
In general, if you wonder what the structure of the value of a variable $var
is, do a
Advantage of this function over alternatives such as serialize
and print_r
is, that it prints PHP code (and is thus readable by anyone who understands PHP (which is likely if you program in PHP)). Disadvantage of var_export
is, that it cannot handle circular structures (e.g. if $a->b == $a
), but neither can JSON.