3v4l.org

run code in 300+ PHP versions simultaneously
<?php $class = new ReflectionClass("ArrayObject"); $method = $class->getMethod("__construct"); foreach ($method->getParameters() as $param) { $value = $param->isDefaultValueAvailable() ? $param->getDefaultValue() : ($param->isOptional() ? null : "error"); print $param->name . " = " . var_export($value, true) . PHP_EOL; } new ArrayObject(null, null, null);
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.29, 8.2.0 - 8.2.23, 8.3.0 - 8.3.11
array = array ( ) flags = 0 iteratorClass = 'ArrayIterator' Fatal error: Uncaught TypeError: ArrayObject::__construct(): Argument #1 ($array) must be of type array, null given in /in/plOeU:11 Stack trace: #0 /in/plOeU(11): ArrayObject->__construct(NULL, NULL, NULL) #1 {main} thrown in /in/plOeU on line 11
Process exited with code 255.
Output for 7.4.16 - 7.4.33
input = NULL flags = NULL iterator_class = NULL Fatal error: Uncaught TypeError: ArrayObject::__construct() expects parameter 3 to be a class name derived from ArrayIterator, '' given in /in/plOeU:11 Stack trace: #0 /in/plOeU(11): ArrayObject->__construct(NULL, NULL, '') #1 {main} thrown in /in/plOeU on line 11
Process exited with code 255.
Output for 7.1.17 - 7.1.33, 7.2.5 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.15
input = NULL flags = NULL iterator_class = NULL Fatal error: Uncaught TypeError: ArrayObject::__construct() expects parameter 3 to be a class name derived from Iterator, '' given in /in/plOeU:11 Stack trace: #0 /in/plOeU(11): ArrayObject->__construct(NULL, NULL, '') #1 {main} thrown in /in/plOeU on line 11
Process exited with code 255.
Output for 7.0.2 - 7.0.33, 7.1.0 - 7.1.16, 7.2.0 - 7.2.4
array = NULL ar_flags = NULL iterator_class = NULL Fatal error: Uncaught TypeError: ArrayObject::__construct() expects parameter 3 to be a class name derived from Iterator, '' given in /in/plOeU:11 Stack trace: #0 /in/plOeU(11): ArrayObject->__construct(NULL, NULL, '') #1 {main} thrown in /in/plOeU on line 11
Process exited with code 255.
Output for 7.0.0 - 7.0.1
array = NULL Fatal error: Uncaught TypeError: ArrayObject::__construct() expects parameter 3 to be a class name derived from Iterator, '' given in /in/plOeU:11 Stack trace: #0 /in/plOeU(11): ArrayObject->__construct(NULL, NULL, '') #1 {main} thrown in /in/plOeU on line 11
Process exited with code 255.
Output for 5.6.13 - 5.6.40
array = NULL Fatal error: Uncaught exception 'InvalidArgumentException' with message 'ArrayObject::__construct() expects parameter 3 to be a class name derived from Iterator, '' given' in /in/plOeU:11 Stack trace: #0 /in/plOeU(11): ArrayObject->__construct(NULL, 0, '') #1 {main} thrown in /in/plOeU on line 11
Process exited with code 255.
Output for 5.6.0 - 5.6.12
array = 'error' Fatal error: Uncaught exception 'InvalidArgumentException' with message 'ArrayObject::__construct() expects parameter 3 to be a class name derived from Iterator, '' given' in /in/plOeU:11 Stack trace: #0 /in/plOeU(11): ArrayObject->__construct(NULL, 0, '') #1 {main} thrown in /in/plOeU on line 11
Process exited with code 255.

preferences:
73.23 ms | 415 KiB | 5 Q