3v4l.org

run code in 300+ PHP versions simultaneously
<?php class a { function __construct() { echo 'hi'; } } //$obj = new ReflectionFunction('phpinfo'); //var_dump(serialize($obj)); $str = 'O:18:"ReflectionFunction":1:{s:4:"info";a:14:{s:4:"name";s:7:"phpinfo";s:7:"closure";s:0:"";s:8:"internal";b:1;s:11:"return_type";b:0;s:3:"doc";b:0;s:6:"params";a:1:{i:0;a:9:{s:5:"index";i:0;s:4:"name";s:4:"what";s:4:"type";s:0:"";s:9:"type_hint";s:0:"";s:8:"function";s:7:"phpinfo";s:8:"nullable";b:1;s:7:"default";i:0;s:11:"defaultText";s:1:"0";s:10:"attributes";a:0:{}}}s:16:"static_variables";a:0:{}s:10:"attributes";a:0:{}s:8:"is_async";b:0;s:10:"is_closure";b:0;s:12:"is_generator";b:0;s:4:"file";s:2:"//";s:5:"line1";i:0;s:5:"line2";i:0;}}'; var_dump(unserialize($str));
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Uncaught Exception: Unserialization of 'ReflectionFunction' is not allowed in /in/BKmES:12 Stack trace: #0 /in/BKmES(12): unserialize('O:18:"Reflectio...') #1 {main} thrown in /in/BKmES on line 12
Process exited with code 255.
Output for 7.4.0 - 7.4.33, 8.0.0 - 8.0.30
Warning: Erroneous data format for unserializing 'ReflectionFunction' in /in/BKmES on line 12 Notice: unserialize(): Error at offset 29 of 546 bytes in /in/BKmES on line 12 bool(false)
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.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.5 - 7.2.33, 7.3.0 - 7.3.33
object(ReflectionFunction)#1 (2) { ["name"]=> string(0) "" ["info"]=> array(14) { ["name"]=> string(7) "phpinfo" ["closure"]=> string(0) "" ["internal"]=> bool(true) ["return_type"]=> bool(false) ["doc"]=> bool(false) ["params"]=> array(1) { [0]=> array(9) { ["index"]=> int(0) ["name"]=> string(4) "what" ["type"]=> string(0) "" ["type_hint"]=> string(0) "" ["function"]=> string(7) "phpinfo" ["nullable"]=> bool(true) ["default"]=> int(0) ["defaultText"]=> string(1) "0" ["attributes"]=> array(0) { } } } ["static_variables"]=> array(0) { } ["attributes"]=> array(0) { } ["is_async"]=> bool(false) ["is_closure"]=> bool(false) ["is_generator"]=> bool(false) ["file"]=> string(2) "//" ["line1"]=> int(0) ["line2"]=> int(0) } }
Output for 5.0.0 - 5.0.2
object(ReflectionFunction)#1 (1) { ["info"]=> array(14) { ["name"]=> string(7) "phpinfo" ["closure"]=> string(0) "" ["internal"]=> bool(true) ["return_type"]=> bool(false) ["doc"]=> bool(false) ["params"]=> array(1) { [0]=> array(9) { ["index"]=> int(0) ["name"]=> string(4) "what" ["type"]=> string(0) "" ["type_hint"]=> string(0) "" ["function"]=> string(7) "phpinfo" ["nullable"]=> bool(true) ["default"]=> int(0) ["defaultText"]=> string(1) "0" ["attributes"]=> array(0) { } } } ["static_variables"]=> array(0) { } ["attributes"]=> array(0) { } ["is_async"]=> bool(false) ["is_closure"]=> bool(false) ["is_generator"]=> bool(false) ["file"]=> string(2) "//" ["line1"]=> int(0) ["line2"]=> int(0) } }
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9
object(__PHP_Incomplete_Class)(2) { ["__PHP_Incomplete_Class_Name"]=> string(18) "reflectionfunction" ["info"]=> array(14) { ["name"]=> string(7) "phpinfo" ["closure"]=> string(0) "" ["internal"]=> bool(true) ["return_type"]=> bool(false) ["doc"]=> bool(false) ["params"]=> array(1) { [0]=> array(9) { ["index"]=> int(0) ["name"]=> string(4) "what" ["type"]=> string(0) "" ["type_hint"]=> string(0) "" ["function"]=> string(7) "phpinfo" ["nullable"]=> bool(true) ["default"]=> int(0) ["defaultText"]=> string(1) "0" ["attributes"]=> array(0) { } } } ["static_variables"]=> array(0) { } ["attributes"]=> array(0) { } ["is_async"]=> bool(false) ["is_closure"]=> bool(false) ["is_generator"]=> bool(false) ["file"]=> string(2) "//" ["line1"]=> int(0) ["line2"]=> int(0) } }

preferences:
291.19 ms | 404 KiB | 384 Q