3v4l.org

run code in 300+ PHP versions simultaneously
<?php $obj = new ArrayObject;var_dump($obj);var_dump(serialize($obj));class MyArrayObject extends ArrayObject{public function __construct(){} public function serialize(){return "";} public function unserialize($data){echo 123;exit;}};$myObj = new MyArrayObject;var_dump($myObj);var_dump(serialize($myObj));$myUnserObj = unserialize("O:13:\"MyArrayObject\":0:{}");var_dump($myUnserObj);$myUnserObj->append(123);var_dump($myUnserObj);
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Deprecated: Return type of MyArrayObject::unserialize($data) should either be compatible with ArrayObject::unserialize(string $data): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/rT5pJ on line 3 Deprecated: Return type of MyArrayObject::serialize() should either be compatible with ArrayObject::serialize(): string, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/rT5pJ on line 3 object(ArrayObject)#1 (1) { ["storage":"ArrayObject":private]=> array(0) { } } string(57) "O:11:"ArrayObject":4:{i:0;i:0;i:1;a:0:{}i:2;a:0:{}i:3;N;}" object(MyArrayObject)#2 (1) { ["storage":"ArrayObject":private]=> array(0) { } } string(59) "O:13:"MyArrayObject":4:{i:0;i:0;i:1;a:0:{}i:2;a:0:{}i:3;N;}" Fatal error: Uncaught UnexpectedValueException: Incomplete or ill-typed serialization data in /in/rT5pJ:3 Stack trace: #0 [internal function]: ArrayObject->__unserialize(Array) #1 /in/rT5pJ(3): unserialize('O:13:"MyArrayOb...') #2 {main} thrown in /in/rT5pJ on line 3
Process exited with code 255.
Output for 7.4.6 - 7.4.33, 8.0.0 - 8.0.30
object(ArrayObject)#1 (1) { ["storage":"ArrayObject":private]=> array(0) { } } string(57) "O:11:"ArrayObject":4:{i:0;i:0;i:1;a:0:{}i:2;a:0:{}i:3;N;}" object(MyArrayObject)#2 (1) { ["storage":"ArrayObject":private]=> array(0) { } } string(59) "O:13:"MyArrayObject":4:{i:0;i:0;i:1;a:0:{}i:2;a:0:{}i:3;N;}" Fatal error: Uncaught UnexpectedValueException: Incomplete or ill-typed serialization data in /in/rT5pJ:3 Stack trace: #0 [internal function]: ArrayObject->__unserialize(Array) #1 /in/rT5pJ(3): unserialize('O:13:"MyArrayOb...') #2 {main} thrown in /in/rT5pJ on line 3
Process exited with code 255.
Output for 7.4.0 - 7.4.5
object(ArrayObject)#1 (1) { ["storage":"ArrayObject":private]=> array(0) { } } string(51) "O:11:"ArrayObject":3:{i:0;i:0;i:1;a:0:{}i:2;a:0:{}}" object(MyArrayObject)#2 (1) { ["storage":"ArrayObject":private]=> array(0) { } } string(53) "O:13:"MyArrayObject":3:{i:0;i:0;i:1;a:0:{}i:2;a:0:{}}" Fatal error: Uncaught UnexpectedValueException: Incomplete or ill-typed serialization data in /in/rT5pJ:3 Stack trace: #0 [internal function]: ArrayObject->__unserialize(Array) #1 /in/rT5pJ(3): unserialize('O:13:"MyArrayOb...') #2 {main} thrown in /in/rT5pJ on line 3
Process exited with code 255.
Output for 7.3.32 - 7.3.33
object(ArrayObject)#1 (1) { ["storage":"ArrayObject":private]=> array(0) { } } string(45) "C:11:"ArrayObject":21:{x:i:0;a:0:{};m:a:0:{}}" object(MyArrayObject)#2 (1) { ["storage":"ArrayObject":private]=> array(0) { } } string(25) "C:13:"MyArrayObject":0:{}" Warning: Erroneous data format for unserializing 'MyArrayObject' in /in/rT5pJ on line 3 bool(false) Fatal error: Uncaught Error: Call to a member function append() on bool in /in/rT5pJ:3 Stack trace: #0 {main} thrown in /in/rT5pJ on line 3
Process exited with code 255.
Output for 7.3.0 - 7.3.31
object(ArrayObject)#1 (1) { ["storage":"ArrayObject":private]=> array(0) { } } string(45) "C:11:"ArrayObject":21:{x:i:0;a:0:{};m:a:0:{}}" object(MyArrayObject)#2 (1) { ["storage":"ArrayObject":private]=> array(0) { } } string(25) "C:13:"MyArrayObject":0:{}" Warning: Erroneous data format for unserializing 'MyArrayObject' in /in/rT5pJ on line 3 Notice: unserialize(): Error at offset 24 of 25 bytes in /in/rT5pJ on line 3 bool(false) Fatal error: Uncaught Error: Call to a member function append() on bool in /in/rT5pJ:3 Stack trace: #0 {main} thrown in /in/rT5pJ on line 3
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33
object(ArrayObject)#1 (1) { ["storage":"ArrayObject":private]=> array(0) { } } string(45) "C:11:"ArrayObject":21:{x:i:0;a:0:{};m:a:0:{}}" object(MyArrayObject)#2 (1) { ["storage":"ArrayObject":private]=> array(0) { } } string(25) "C:13:"MyArrayObject":0:{}" Warning: Erroneous data format for unserializing 'MyArrayObject' in /in/rT5pJ on line 3 Notice: unserialize(): Error at offset 24 of 25 bytes in /in/rT5pJ on line 3 bool(false) Fatal error: Uncaught Error: Call to a member function append() on boolean in /in/rT5pJ:3 Stack trace: #0 {main} thrown in /in/rT5pJ on line 3
Process exited with code 255.
Output for 5.6.7 - 5.6.28
object(ArrayObject)#1 (1) { ["storage":"ArrayObject":private]=> array(0) { } } string(45) "C:11:"ArrayObject":21:{x:i:0;a:0:{};m:a:0:{}}" object(MyArrayObject)#2 (1) { ["storage":"ArrayObject":private]=> array(0) { } } string(25) "C:13:"MyArrayObject":0:{}" Warning: Erroneous data format for unserializing 'MyArrayObject' in /in/rT5pJ on line 3 Notice: unserialize(): Error at offset 24 of 25 bytes in /in/rT5pJ on line 3 bool(false) Fatal error: Call to a member function append() on boolean in /in/rT5pJ on line 3
Process exited with code 255.
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.28, 5.4.30 - 5.4.45, 5.5.24 - 5.5.35
object(ArrayObject)#1 (1) { ["storage":"ArrayObject":private]=> array(0) { } } string(45) "C:11:"ArrayObject":21:{x:i:0;a:0:{};m:a:0:{}}" object(MyArrayObject)#2 (1) { ["storage":"ArrayObject":private]=> array(0) { } } string(25) "C:13:"MyArrayObject":0:{}" object(MyArrayObject)#3 (1) { ["storage":"ArrayObject":private]=> array(0) { } } object(MyArrayObject)#3 (1) { ["storage":"ArrayObject":private]=> array(1) { [0]=> int(123) } }
Output for 5.4.29
object(ArrayObject)#1 (1) { ["storage":"ArrayObject":private]=> array(0) { } } string(45) "C:11:"ArrayObject":21:{x:i:0;a:0:{};m:a:0:{}}" object(MyArrayObject)#2 (1) { ["storage":"ArrayObject":private]=> array(0) { } } string(25) "C:13:"MyArrayObject":0:{}" Warning: Erroneous data format for unserializing 'MyArrayObject' in /in/rT5pJ on line 3 Notice: unserialize(): Error at offset 24 of 25 bytes in /in/rT5pJ on line 3 bool(false) Fatal error: Call to a member function append() on a non-object in /in/rT5pJ on line 3
Process exited with code 255.
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17
object(ArrayObject)#1 (0) { } string(23) "O:11:"ArrayObject":0:{}" object(MyArrayObject)#2 (0) { } string(25) "O:13:"MyArrayObject":0:{}" object(MyArrayObject)#3 (0) { } object(MyArrayObject)#3 (1) { [0]=> int(123) }
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/rT5pJ on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/rT5pJ on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/rT5pJ on line 3
Process exited with code 255.

preferences:
241.98 ms | 401 KiB | 357 Q