3v4l.org

run code in 300+ PHP versions simultaneously
<?php $rc = new ReflectionClass('ArrayIterator'); foreach ($rc->getMethods() as $method) { if ($method->isAbstract() || $method->isStatic()) continue; foreach ($method->getParameters() as $param) { var_dump($method->name); foreach ($method->getParameters() as $param) { if ($param->isOptional()) var_dump([$param->name, $param->getDefaultValue()]); } } }
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
string(11) "__construct" array(2) { [0]=> string(5) "array" [1]=> array(0) { } } array(2) { [0]=> string(5) "flags" [1]=> int(0) } string(11) "__construct" array(2) { [0]=> string(5) "array" [1]=> array(0) { } } array(2) { [0]=> string(5) "flags" [1]=> int(0) } string(12) "offsetExists" string(9) "offsetGet" string(9) "offsetSet" string(9) "offsetSet" string(11) "offsetUnset" string(6) "append" string(8) "setFlags" string(5) "asort" array(2) { [0]=> string(5) "flags" [1]=> int(0) } string(5) "ksort" array(2) { [0]=> string(5) "flags" [1]=> int(0) } string(6) "uasort" string(6) "uksort" string(11) "unserialize" string(13) "__unserialize" string(4) "seek"
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
string(11) "__construct" Fatal error: Uncaught ReflectionException: Cannot determine default value for internal functions in /in/aVSjn:17 Stack trace: #0 /in/aVSjn(17): ReflectionParameter->getDefaultValue() #1 {main} thrown in /in/aVSjn on line 17
Process exited with code 255.
Output for 5.6.13 - 5.6.38
string(11) "__construct" Fatal error: Uncaught exception 'ReflectionException' with message 'Cannot determine default value for internal functions' in /in/aVSjn:17 Stack trace: #0 /in/aVSjn(17): ReflectionParameter->getDefaultValue() #1 {main} thrown in /in/aVSjn on line 17
Process exited with code 255.
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.12
string(11) "__construct" string(12) "offsetExists" string(9) "offsetGet" string(9) "offsetSet" string(9) "offsetSet" string(11) "offsetUnset" string(6) "append" string(8) "setFlags" string(6) "uasort" string(6) "uksort" string(11) "unserialize" string(4) "seek"

preferences:
271.12 ms | 402 KiB | 364 Q