3v4l.org

run code in 300+ PHP versions simultaneously
<?php $someJson = '{"":""}'; $myObject = json_decode($someJSON); $newJson = json_encode($myObject); var_dump($someJson, $newJson, $someJson === $newJson); $myObject = (object)[""=>""]; $serialized = serialize($myObject); var_dump($myObject, $serialized); $unserialized = unserialize($myObject); var_dump($unserialized);
Output for 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Warning: Undefined variable $someJSON in /in/3037d on line 4 Deprecated: json_decode(): Passing null to parameter #1 ($json) of type string is deprecated in /in/3037d on line 4 string(7) "{"":""}" string(4) "null" bool(false) object(stdClass)#1 (1) { [""]=> string(0) "" } string(33) "O:8:"stdClass":1:{s:0:"";s:0:"";}" Fatal error: Uncaught TypeError: unserialize(): Argument #1 ($data) must be of type string, stdClass given in /in/3037d:12 Stack trace: #0 /in/3037d(12): unserialize(Object(stdClass)) #1 {main} thrown in /in/3037d on line 12
Process exited with code 255.
Output for 8.0.0 - 8.0.30
Warning: Undefined variable $someJSON in /in/3037d on line 4 string(7) "{"":""}" string(4) "null" bool(false) object(stdClass)#1 (1) { [""]=> string(0) "" } string(33) "O:8:"stdClass":1:{s:0:"";s:0:"";}" Fatal error: Uncaught TypeError: unserialize(): Argument #1 ($data) must be of type string, stdClass given in /in/3037d:12 Stack trace: #0 /in/3037d(12): unserialize(Object(stdClass)) #1 {main} thrown in /in/3037d on line 12
Process exited with code 255.
Output for 5.6.21 - 5.6.28, 7.0.6 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
Notice: Undefined variable: someJSON in /in/3037d on line 4 string(7) "{"":""}" string(4) "null" bool(false) object(stdClass)#1 (1) { [""]=> string(0) "" } string(33) "O:8:"stdClass":1:{s:0:"";s:0:"";}" Warning: unserialize() expects parameter 1 to be string, object given in /in/3037d on line 12 bool(false)
Output for 7.3.32 - 7.3.33
string(7) "{"":""}" string(4) "null" bool(false) object(stdClass)#1 (1) { [""]=> string(0) "" } string(33) "O:8:"stdClass":1:{s:0:"";s:0:"";}" Warning: unserialize() expects parameter 1 to be string, object given in /in/3037d on line 12 bool(false)
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.20, 7.0.0 - 7.0.5
Notice: Undefined variable: someJSON in /in/3037d on line 4 string(7) "{"":""}" string(4) "null" bool(false) object(stdClass)#1 (1) { Notice: Illegal member variable name in /in/3037d on line 11 [""]=> string(0) "" } string(33) "O:8:"stdClass":1:{s:0:"";s:0:"";}" Warning: unserialize() expects parameter 1 to be string, object given in /in/3037d on line 12 bool(false)

preferences:
175.79 ms | 402 KiB | 249 Q