3v4l.org

run code in 300+ PHP versions simultaneously
<?php $iterator = new GlobIterator('*.php', FilesystemIterator::KEY_AS_FILENAME); var_dump($iterator->count()); $iterator = glob('*.php'); var_dump(count($iterator));
Output for 5.3.0 - 5.3.6, 5.6.24 - 5.6.40, 7.0.10 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.26, 7.4.33, 8.0.0 - 8.0.13, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
int(0) int(0)
Output for 7.4.27 - 7.4.32, 8.0.14 - 8.0.30, 8.1.0 - 8.1.28
Fatal error: Uncaught UnexpectedValueException: GlobIterator::__construct(): open_basedir restriction in effect. File(*.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/mojHW:3 Stack trace: #0 /in/mojHW(3): GlobIterator->__construct('*.php', 256) #1 {main} thrown in /in/mojHW on line 3
Process exited with code 255.
Output for 7.0.0 - 7.0.9
Fatal error: Uncaught LogicException: The parent constructor was not called: the object is in an invalid state in /in/mojHW:4 Stack trace: #0 /in/mojHW(4): SplFileInfo->_bad_state_ex() #1 {main} thrown in /in/mojHW on line 4
Process exited with code 255.
Output for 5.3.7 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.23
Fatal error: Uncaught exception 'LogicException' with message 'The parent constructor was not called: the object is in an invalid state ' in /in/mojHW:4 Stack trace: #0 /in/mojHW(4): SplFileInfo->_bad_state_ex() #1 {main} thrown in /in/mojHW on line 4
Process exited with code 255.
Output for 5.2.3 - 5.2.17
Fatal error: Class 'GlobIterator' not found in /in/mojHW on line 3
Process exited with code 255.
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.2
<br /> <b>Fatal error</b>: Class 'GlobIterator' not found in <b>/in/mojHW</b> on line <b>3</b><br />
Process exited with code 255.
Output for 4.4.2 - 4.4.9
<br /> <b>Parse error</b>: syntax error, unexpected ')', expecting '(' in <b>/in/mojHW</b> on line <b>3</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 ')', expecting '(' in <b>/in/mojHW</b> on line <b>3</b><br />
Process exited with code 255.
Output for 4.3.2 - 4.3.4
<br /> <b>Parse error</b>: parse error, expecting `'('' in <b>/in/mojHW</b> on line <b>3</b><br />
Process exited with code 255.

preferences:
364.82 ms | 401 KiB | 468 Q