3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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 7.0.0 - 7.1.0
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.4.28, 5.4.30 - 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.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.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.