I am passing a list of numbers from a page to PHP serialized in JSON
{"items":"[1,2,3,4]"}
in my URL it is just
...&items={"items":[1,2,3,4]}
I decode this in PHP
$json = $_GET["items"];
$arr = json_decode($json, true);
I get an array
Array ( [items] => [1,2,4] )
But when I try a foreach on arr["items"] and print out each value, all I get is a single value
[1,2,4]
This is the code I am using to iterate
foreach($res["items"] as $value)
echo $value;
How come I am not getting something like
1
2
4
$_GET["items"]to access each value?