3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = <<<'EOL' { "syndicate-to": [ { "uid": "https://myfavoritesocialnetwork.example/aaronpk", "name": "aaronpk on myfavoritesocialnetwork", "service": { "name": "My Favorite Social Network", "url": "https://myfavoritesocialnetwork.example/", "photo": "https://myfavoritesocialnetwork.example/img/icon.png" }, "user": { "name": "aaronpk", "url": "https://myfavoritesocialnetwork.example/aaronpk", "photo": "https://myfavoritesocialnetwork.example/aaronpk/photo.jpg" } } ] } EOL; $data = json_decode($json, true); var_dump($data); var_dump(json_last_error()); var_dump($data['syndicate-to'][0]['uid']);
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.38, 7.0.0 - 7.0.31, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.31, 8.2.0 - 8.2.26, 8.3.0 - 8.3.15, 8.4.1 - 8.4.2
array(1) { ["syndicate-to"]=> array(1) { [0]=> array(4) { ["uid"]=> string(47) "https://myfavoritesocialnetwork.example/aaronpk" ["name"]=> string(34) "aaronpk on myfavoritesocialnetwork" ["service"]=> array(3) { ["name"]=> string(26) "My Favorite Social Network" ["url"]=> string(40) "https://myfavoritesocialnetwork.example/" ["photo"]=> string(52) "https://myfavoritesocialnetwork.example/img/icon.png" } ["user"]=> array(3) { ["name"]=> string(7) "aaronpk" ["url"]=> string(47) "https://myfavoritesocialnetwork.example/aaronpk" ["photo"]=> string(57) "https://myfavoritesocialnetwork.example/aaronpk/photo.jpg" } } } } int(0) string(47) "https://myfavoritesocialnetwork.example/aaronpk"

preferences:
84.08 ms | 410 KiB | 5 Q