3v4l.org

run code in 300+ PHP versions simultaneously
<?php class RefMef { private $_; public function __construct($ref) { $this->_ = $ref; } } class RoleStorage extends SPLObjectStorage { private $membres; public function serialize() { return parent::serialize(); } public function unserialize($serialized) { var_dump($serialized); parent::unserialize($serialized); } } $obj1 = new RefMef(1); $obj2 = new RefMef($obj1); $test = new RoleStorage; // $test->attach($obj2); // $test->attach($obj1); // $test->attach($test); echo $ser = serialize($test), "\n"; $try = unserialize($ser); // $test = unserialize('C:11:"RoleStorage":23:{x:i:1;N;,r:13;;m:a:0:{}}');
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.7
Deprecated: Return type of RoleStorage::unserialize($serialized) should either be compatible with SplObjectStorage::unserialize(string $data): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/jNLZM on line 18 Deprecated: Return type of RoleStorage::serialize() should either be compatible with SplObjectStorage::serialize(): string, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/jNLZM on line 15 O:11:"RoleStorage":2:{i:0;a:0:{}i:1;a:1:{s:20:"RoleStoragemembres";N;}}
Output for 7.4.0 - 7.4.33, 8.0.0 - 8.0.30
O:11:"RoleStorage":2:{i:0;a:0:{}i:1;a:1:{s:20:"RoleStoragemembres";N;}}
Output for 5.2.2 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.35, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.12 - 7.3.33
C:11:"RoleStorage":44:{x:i:0;m:a:1:{s:20:"RoleStoragemembres";N;}} string(44) "x:i:0;m:a:1:{s:20:"RoleStoragemembres";N;}"
Output for 5.1.1 - 5.1.6, 5.2.0 - 5.2.1
O:11:"RoleStorage":1:{s:20:"RoleStoragemembres";N;}
Output for 5.1.0
<br /> <b>Fatal error</b>: fatal flex scanner internal error--end of buffer missed in <b>/in/jNLZM</b> on line <b>36</b><br />
Process exited with code 255.
Output for 5.0.0 - 5.0.5
<br /> <b>Fatal error</b>: Class 'SPLObjectStorage' not found in <b>/in/jNLZM</b> on line <b>11</b><br />
Process exited with code 255.
Output for 4.4.2 - 4.4.9
<br /> <b>Parse error</b>: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in <b>/in/jNLZM</b> on line <b>5</b><br />
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
<br /> <b>Parse error</b>: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in <b>/in/jNLZM</b> on line <b>5</b><br />
Process exited with code 255.
Output for 4.3.2 - 4.3.4
<br /> <b>Parse error</b>: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in <b>/in/jNLZM</b> on line <b>5</b><br />
Process exited with code 255.

preferences:
187.97 ms | 402 KiB | 346 Q