3v4l.org

run code in 300+ PHP versions simultaneously
<?php class a { function b() {} } $r = new ReflectionMethod(new a, "b"); var_dump($r->getParameters()); $s = serialize($r); var_dump($s); $r = unserialize($s); var_dump($r->getParameters());
Output for 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
array(0) { } Fatal error: Uncaught Exception: Serialization of 'ReflectionMethod' is not allowed in /in/G2I4A:10 Stack trace: #0 /in/G2I4A(10): serialize(Object(ReflectionMethod)) #1 {main} thrown in /in/G2I4A on line 10
Process exited with code 255.
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33
array(0) { } string(67) "O:16:"ReflectionMethod":2:{s:4:"name";s:1:"b";s:5:"class";s:1:"a";}" Fatal error: Uncaught Error: Internal error: Failed to retrieve the reflection object in /in/G2I4A:15 Stack trace: #0 /in/G2I4A(15): ReflectionFunctionAbstract->getParameters() #1 {main} thrown in /in/G2I4A on line 15
Process exited with code 255.
Output for 5.3.3 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.37, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20
array(0) { } string(67) "O:16:"ReflectionMethod":2:{s:4:"name";s:1:"b";s:5:"class";s:1:"a";}" Fatal error: ReflectionFunctionAbstract::getParameters(): Internal error: Failed to retrieve the reflection object in /in/G2I4A on line 15
Process exited with code 255.
Output for 5.0.3 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.2
array(0) { } string(67) "O:16:"ReflectionMethod":2:{s:4:"name";s:1:"b";s:5:"class";s:1:"a";}" Fatal error: Internal error: Failed to retrieve the reflection object in /in/G2I4A on line 15
Process exited with code 255.
Output for 5.0.0 - 5.0.2
array(0) { } string(67) "O:16:"ReflectionMethod":2:{s:5:"class";s:1:"a";s:4:"name";s:1:"b";}" Fatal error: Internal error: Failed to retrieve the reflection object in /in/G2I4A on line 15
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9
Fatal error: Cannot instantiate non-existent class: reflectionmethod in /in/G2I4A on line 7
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: reflectionmethod in /in/G2I4A on line 7

preferences:
251.45 ms | 401 KiB | 380 Q