$my_array = array(
0 => array(
1,
2,
3,
),
1 => array(
1,
2,
3,
),
2 => array(
1,
2,
3,
),
);
echo json_encode($my_array);
Result is this:
[[1,2,3],[1,2,3],[1,2,3]]
I thought the output should be a string of json,but here outputs a pure array,why?In other words,the result should be quoted,but why this is not.
{}braces. The array in your question has only numeric keys, so it remains a JSON array with square[]brackets, and the keys remain unquoted. Look at meda's answer if you want to always encode as objects.