I want to send an array table from PHP to JSON. my array table is simple:
[0] => 10
[1] => 20
I want to see it in Json as
{ "values":["10","20"] }
In PHP, I tried
$values=array("10","20");
echo(
'{
"values": '.$values.',
"text": "abcdef"
}'
);
But it displays: { "values":Array] }
Do you know how I can do this ? (Values in my arrays are not always with a size of 2, it can evolve depending, so I don't want to use values[0] and values[1].
json_encodefor that