3v4l.org

run code in 300+ PHP versions simultaneously
<?php //will got current directory list $glob = glob('./*'); print_r($glob); //will got nothing? $glob = new GlobIterator('./*'); print_r(iterator_to_array($glob));
Output for 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Array ( [0] => ./etc [1] => ./in [2] => ./tmp ) Array ( [./etc] => SplFileInfo Object ( [pathName:SplFileInfo:private] => ./etc [fileName:SplFileInfo:private] => etc ) [./in] => SplFileInfo Object ( [pathName:SplFileInfo:private] => ./in [fileName:SplFileInfo:private] => in ) [./tmp] => SplFileInfo Object ( [pathName:SplFileInfo:private] => ./tmp [fileName:SplFileInfo:private] => tmp ) )
Output for 7.4.27 - 7.4.32, 8.0.14 - 8.0.30, 8.1.0 - 8.1.28
Array ( [0] => ./etc [1] => ./in [2] => ./tmp ) Fatal error: Uncaught UnexpectedValueException: GlobIterator::__construct(): open_basedir restriction in effect. File(./*) is not within the allowed path(s): (/tmp:/in:/etc) in /in/H62a3:7 Stack trace: #0 /in/H62a3(7): GlobIterator->__construct('./*') #1 {main} thrown in /in/H62a3 on line 7
Process exited with code 255.
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 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
Array ( [0] => ./bin [1] => ./boot [2] => ./dev [3] => ./etc [4] => ./home [5] => ./in [6] => ./lib [7] => ./lib64 [8] => ./mnt [9] => ./opt [10] => ./proc [11] => ./root [12] => ./run [13] => ./sbin [14] => ./srv [15] => ./sys [16] => ./tmp [17] => ./usr [18] => ./var ) Array ( [./bin] => SplFileInfo Object ( [pathName:SplFileInfo:private] => ./bin [fileName:SplFileInfo:private] => bin ) [./boot] => SplFileInfo Object ( [pathName:SplFileInfo:private] => ./boot [fileName:SplFileInfo:private] => boot ) [./dev] => SplFileInfo Object ( [pathName:SplFileInfo:private] => ./dev [fileName:SplFileInfo:private] => dev ) [./etc] => SplFileInfo Object ( [pathName:SplFileInfo:private] => ./etc [fileName:SplFileInfo:private] => etc ) [./home] => SplFileInfo Object ( [pathName:SplFileInfo:private] => ./home [fileName:SplFileInfo:private] => home ) [./in] => SplFileInfo Object ( [pathName:SplFileInfo:private] => ./in [fileName:SplFileInfo:private] => in ) [./lib] => SplFileInfo Object ( [pathName:SplFileInfo:private] => ./lib [fileName:SplFileInfo:private] => lib ) [./lib64] => SplFileInfo Object ( [pathName:SplFileInfo:private] => ./lib64 [fileName:SplFileInfo:private] => lib64 ) [./mnt] => SplFileInfo Object ( [pathName:SplFileInfo:private] => ./mnt [fileName:SplFileInfo:private] => mnt ) [./opt] => SplFileInfo Object ( [pathName:SplFileInfo:private] => ./opt [fileName:SplFileInfo:private] => opt ) [./proc] => SplFileInfo Object ( [pathName:SplFileInfo:private] => ./proc [fileName:SplFileInfo:private] => proc ) [./root] => SplFileInfo Object ( [pathName:SplFileInfo:private] => ./root [fileName:SplFileInfo:private] => root ) [./run] => SplFileInfo Object ( [pathName:SplFileInfo:private] => ./run [fileName:SplFileInfo:private] => run ) [./sbin] => SplFileInfo Object ( [pathName:SplFileInfo:private] => ./sbin [fileName:SplFileInfo:private] => sbin ) [./srv] => SplFileInfo Object ( [pathName:SplFileInfo:private] => ./srv [fileName:SplFileInfo:private] => srv ) [./sys] => SplFileInfo Object ( [pathName:SplFileInfo:private] => ./sys [fileName:SplFileInfo:private] => sys ) [./tmp] => SplFileInfo Object ( [pathName:SplFileInfo:private] => ./tmp [fileName:SplFileInfo:private] => tmp ) [./usr] => SplFileInfo Object ( [pathName:SplFileInfo:private] => ./usr [fileName:SplFileInfo:private] => usr ) [./var] => SplFileInfo Object ( [pathName:SplFileInfo:private] => ./var [fileName:SplFileInfo:private] => var ) )
Output for 5.2.3 - 5.2.17
Array ( [0] => ./bin [1] => ./boot [2] => ./dev [3] => ./etc [4] => ./home [5] => ./in [6] => ./lib [7] => ./lib64 [8] => ./mnt [9] => ./opt [10] => ./proc [11] => ./root [12] => ./run [13] => ./sbin [14] => ./srv [15] => ./sys [16] => ./tmp [17] => ./usr [18] => ./var ) Fatal error: Class 'GlobIterator' not found in /in/H62a3 on line 7
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
Array ( ) <br /> <b>Fatal error</b>: Class 'GlobIterator' not found in <b>/in/H62a3</b> on line <b>7</b><br />
Process exited with code 255.
Output for 4.3.2 - 4.3.6, 4.3.9 - 4.3.11, 4.4.0 - 4.4.9
Array ( ) <br /> <b>Fatal error</b>: Cannot instantiate non-existent class: globiterator in <b>/in/H62a3</b> on line <b>7</b><br />
Process exited with code 255.
Output for 4.3.7 - 4.3.8
<br /> <b>Fatal error</b>: Cannot instantiate non-existent class: globiterator in <b>/in/H62a3</b> on line <b>7</b><br />
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Array ( ) <br /> <b>Fatal error</b>: Cannot instantiate non-existent class: globiterator in <b>/in/H62a3</b> on line <b>7</b><br />

preferences:
364.26 ms | 401 KiB | 468 Q