With this code I am iterating through an object.
Works:
- Windows with WAMP and PHP 5.2.9
- Linux web server with PHP 5.2.10
It is not working on my desktop:
- Ubuntu 9.10 with PHP 5.2.10-2 from
the repo’s
$incomingData = json_decode($_POST['data']); foreach($incomingData as $key => $action) { }Invalid argument supplied for
foreach()
Maybe one of your servers has magic_quotes_gpc enabled, so you can try to use stripslashes on $_POST[‘data’] before you decode it. Both PHP versions should be able to iterate through objects.