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); var_dump($data); var_dump(json_last_error()); var_dump($data->syndicate-to);
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.30, 8.2.0 - 8.2.25, 8.3.0 - 8.3.13
object(stdClass)#4 (1) { ["syndicate-to"]=> array(1) { [0]=> object(stdClass)#1 (4) { ["uid"]=> string(47) "https://myfavoritesocialnetwork.example/aaronpk" ["name"]=> string(34) "aaronpk on myfavoritesocialnetwork" ["service"]=> object(stdClass)#2 (3) { ["name"]=> string(26) "My Favorite Social Network" ["url"]=> string(40) "https://myfavoritesocialnetwork.example/" ["photo"]=> string(52) "https://myfavoritesocialnetwork.example/img/icon.png" } ["user"]=> object(stdClass)#3 (3) { ["name"]=> string(7) "aaronpk" ["url"]=> string(47) "https://myfavoritesocialnetwork.example/aaronpk" ["photo"]=> string(57) "https://myfavoritesocialnetwork.example/aaronpk/photo.jpg" } } } } int(0) Warning: Undefined property: stdClass::$syndicate in /in/3akiR on line 27 Fatal error: Uncaught Error: Undefined constant "to" in /in/3akiR:27 Stack trace: #0 {main} thrown in /in/3akiR on line 27
Process exited with code 255.
Output for 7.2.0 - 7.2.33, 7.3.16 - 7.3.31, 7.4.0 - 7.4.33
object(stdClass)#4 (1) { ["syndicate-to"]=> array(1) { [0]=> object(stdClass)#1 (4) { ["uid"]=> string(47) "https://myfavoritesocialnetwork.example/aaronpk" ["name"]=> string(34) "aaronpk on myfavoritesocialnetwork" ["service"]=> object(stdClass)#2 (3) { ["name"]=> string(26) "My Favorite Social Network" ["url"]=> string(40) "https://myfavoritesocialnetwork.example/" ["photo"]=> string(52) "https://myfavoritesocialnetwork.example/img/icon.png" } ["user"]=> object(stdClass)#3 (3) { ["name"]=> string(7) "aaronpk" ["url"]=> string(47) "https://myfavoritesocialnetwork.example/aaronpk" ["photo"]=> string(57) "https://myfavoritesocialnetwork.example/aaronpk/photo.jpg" } } } } int(0) Notice: Undefined property: stdClass::$syndicate in /in/3akiR on line 27 Warning: Use of undefined constant to - assumed 'to' (this will throw an Error in a future version of PHP) in /in/3akiR on line 27 Warning: A non-numeric value encountered in /in/3akiR on line 27 int(0)
Output for 7.3.32 - 7.3.33
object(stdClass)#4 (1) { ["syndicate-to"]=> array(1) { [0]=> object(stdClass)#1 (4) { ["uid"]=> string(47) "https://myfavoritesocialnetwork.example/aaronpk" ["name"]=> string(34) "aaronpk on myfavoritesocialnetwork" ["service"]=> object(stdClass)#2 (3) { ["name"]=> string(26) "My Favorite Social Network" ["url"]=> string(40) "https://myfavoritesocialnetwork.example/" ["photo"]=> string(52) "https://myfavoritesocialnetwork.example/img/icon.png" } ["user"]=> object(stdClass)#3 (3) { ["name"]=> string(7) "aaronpk" ["url"]=> string(47) "https://myfavoritesocialnetwork.example/aaronpk" ["photo"]=> string(57) "https://myfavoritesocialnetwork.example/aaronpk/photo.jpg" } } } } int(0) Warning: Use of undefined constant to - assumed 'to' (this will throw an Error in a future version of PHP) in /in/3akiR on line 27 Warning: A non-numeric value encountered in /in/3akiR on line 27 int(0)
Output for 7.1.0 - 7.1.20
object(stdClass)#4 (1) { ["syndicate-to"]=> array(1) { [0]=> object(stdClass)#1 (4) { ["uid"]=> string(47) "https://myfavoritesocialnetwork.example/aaronpk" ["name"]=> string(34) "aaronpk on myfavoritesocialnetwork" ["service"]=> object(stdClass)#2 (3) { ["name"]=> string(26) "My Favorite Social Network" ["url"]=> string(40) "https://myfavoritesocialnetwork.example/" ["photo"]=> string(52) "https://myfavoritesocialnetwork.example/img/icon.png" } ["user"]=> object(stdClass)#3 (3) { ["name"]=> string(7) "aaronpk" ["url"]=> string(47) "https://myfavoritesocialnetwork.example/aaronpk" ["photo"]=> string(57) "https://myfavoritesocialnetwork.example/aaronpk/photo.jpg" } } } } int(0) Notice: Undefined property: stdClass::$syndicate in /in/3akiR on line 27 Notice: Use of undefined constant to - assumed 'to' in /in/3akiR on line 27 Warning: A non-numeric value encountered in /in/3akiR on line 27 int(0)
Output for 7.0.0 - 7.0.20
object(stdClass)#4 (1) { ["syndicate-to"]=> array(1) { [0]=> object(stdClass)#1 (4) { ["uid"]=> string(47) "https://myfavoritesocialnetwork.example/aaronpk" ["name"]=> string(34) "aaronpk on myfavoritesocialnetwork" ["service"]=> object(stdClass)#2 (3) { ["name"]=> string(26) "My Favorite Social Network" ["url"]=> string(40) "https://myfavoritesocialnetwork.example/" ["photo"]=> string(52) "https://myfavoritesocialnetwork.example/img/icon.png" } ["user"]=> object(stdClass)#3 (3) { ["name"]=> string(7) "aaronpk" ["url"]=> string(47) "https://myfavoritesocialnetwork.example/aaronpk" ["photo"]=> string(57) "https://myfavoritesocialnetwork.example/aaronpk/photo.jpg" } } } } int(0) Notice: Undefined property: stdClass::$syndicate in /in/3akiR on line 27 Notice: Use of undefined constant to - assumed 'to' in /in/3akiR on line 27 int(0)
Output for 5.5.0 - 5.5.37, 5.6.0 - 5.6.28
object(stdClass)#1 (1) { ["syndicate-to"]=> array(1) { [0]=> object(stdClass)#2 (4) { ["uid"]=> string(47) "https://myfavoritesocialnetwork.example/aaronpk" ["name"]=> string(34) "aaronpk on myfavoritesocialnetwork" ["service"]=> object(stdClass)#3 (3) { ["name"]=> string(26) "My Favorite Social Network" ["url"]=> string(40) "https://myfavoritesocialnetwork.example/" ["photo"]=> string(52) "https://myfavoritesocialnetwork.example/img/icon.png" } ["user"]=> object(stdClass)#4 (3) { ["name"]=> string(7) "aaronpk" ["url"]=> string(47) "https://myfavoritesocialnetwork.example/aaronpk" ["photo"]=> string(57) "https://myfavoritesocialnetwork.example/aaronpk/photo.jpg" } } } } int(0) Notice: Undefined property: stdClass::$syndicate in /in/3akiR on line 27 Notice: Use of undefined constant to - assumed 'to' in /in/3akiR on line 27 int(0)

preferences:
45.77 ms | 421 KiB | 5 Q