3v4l.org

run code in 300+ PHP versions simultaneously
<?php const NL = PHP_EOL; $json = '{ "access_token": "ya29.Il-4B7Tpewa", "token_type": "Bearer", "expires_in": 3600, "refresh_token": "1//09ghRt", "scope": "https://www.googleapis.com/auth/fitness.location.read https://www.googleapis.com/auth/fitness.activity.read" } 1'; $jsonObj = json_decode($json); echo $jsonObj->access_token; echo NL; echo $jsonObj->refresh_token; echo NL; echo $jsonObj->expires_in; echo NL; $jsonArr = json_decode($json, true); echo $jsonArr['access_token']; echo NL; echo $jsonArr['refresh_token']; echo NL; echo $jsonArr['expires_in'];
Output for 8.3.0 - 8.3.4, 8.3.6 - 8.3.7
Warning: Attempt to read property "access_token" on null in /in/71W7r on line 11 Warning: Attempt to read property "refresh_token" on null in /in/71W7r on line 13 Warning: Attempt to read property "expires_in" on null in /in/71W7r on line 15 Warning: Trying to access array offset on null in /in/71W7r on line 19 Warning: Trying to access array offset on null in /in/71W7r on line 21 Warning: Trying to access array offset on null in /in/71W7r on line 23
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Warning: Attempt to read property "access_token" on null in /in/71W7r on line 11 Warning: Attempt to read property "refresh_token" on null in /in/71W7r on line 13 Warning: Attempt to read property "expires_in" on null in /in/71W7r on line 15 Warning: Trying to access array offset on null in /in/71W7r on line 19 Warning: Trying to access array offset on null in /in/71W7r on line 21 Warning: Trying to access array offset on null in /in/71W7r on line 23
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18
Warning: Attempt to read property "access_token" on null in /in/71W7r on line 11 Warning: Attempt to read property "refresh_token" on null in /in/71W7r on line 13 Warning: Attempt to read property "expires_in" on null in /in/71W7r on line 15 Warning: Trying to access array offset on value of type null in /in/71W7r on line 19 Warning: Trying to access array offset on value of type null in /in/71W7r on line 21 Warning: Trying to access array offset on value of type null in /in/71W7r on line 23
Output for 7.4.0 - 7.4.25, 7.4.27 - 7.4.33
Notice: Trying to get property 'access_token' of non-object in /in/71W7r on line 11 Notice: Trying to get property 'refresh_token' of non-object in /in/71W7r on line 13 Notice: Trying to get property 'expires_in' of non-object in /in/71W7r on line 15 Notice: Trying to access array offset on value of type null in /in/71W7r on line 19 Notice: Trying to access array offset on value of type null in /in/71W7r on line 21 Notice: Trying to access array offset on value of type null in /in/71W7r on line 23
Output for 7.3.32, 7.4.26
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.3.33
Notice: Trying to get property 'access_token' of non-object in /in/71W7r on line 11 Notice: Trying to get property 'refresh_token' of non-object in /in/71W7r on line 13 Notice: Trying to get property 'expires_in' of non-object in /in/71W7r on line 15

preferences:
143.58 ms | 402 KiB | 176 Q