1
I’m trying to traverse the foreach with a populated JSON array. To make it easier I’m testing via $_GET (but I’ve tried it with an array populated by php but it didn’t work). The $_GET is like this:
$amigos = json_decode($_GET['amigos']);
The foreach is like this:
foreach ($amigos as $a)
And the data passed via $_GET is like this:
[{'nome':'bruno','email':'[email protected]'}]
Always returns me the error message:
Invalid argument supplied for foreach()
I don’t understand why this is happening. Any ideas?
att
doing so and just removing the simple quotes before and after the array works via $_GET, I will test using php to generate the array and return here..
– Angular Man
It worked @Angularman?
– Miguel
It did work @Miguel, thanks for your help..
– Angular Man
You’re welcome @Angularman, if the answer helped please accept it
– Miguel