3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function foo($arg){ var_dump($arg); $path = '../dir/'.$arg; echo $arg; $results = scandir($arg); } preg_replace('/a/', foo("$1"), 'a');
Output for 5.2.3 - 5.6.28, 7.0.0 - 7.1.0
string(2) "$1" $1 Warning: scandir($1): failed to open dir: No such file or directory in /in/kASOi on line 6 Warning: scandir(): (errno 2): No such file or directory in /in/kASOi on line 6
Output for hhvm-3.10.0 - 3.12.0
string(2) "$1" $1 Warning: No such file or directory in /in/kASOi on line 6
Output for 5.0.0 - 5.2.2
string(2) "$1" $1<br /> <b>Warning</b>: scandir($1) [<a href='function.scandir'>function.scandir</a>]: failed to open dir: No such file or directory in <b>/in/kASOi</b> on line <b>6</b><br /> <br /> <b>Warning</b>: scandir() [<a href='function.scandir'>function.scandir</a>]: (errno 2): No such file or directory in <b>/in/kASOi</b> on line <b>6</b><br />
Output for 4.4.5 - 4.4.9
string(2) "$1" $1<br /> <b>Fatal error</b>: Call to undefined function: scandir() in <b>/in/kASOi</b> on line <b>6</b><br />
Process exited with code 255.
Output for 4.3.2 - 4.4.4
string(2) "$1" $1<br /> <b>Fatal error</b>: Call to undefined function: scandir() in <b>/in/kASOi</b> on line <b>6</b><br />
Process exited with code 255.
Output for 4.3.0 - 4.3.1
string(2) "$1" $1<br /> <b>Fatal error</b>: Call to undefined function: scandir() in <b>/in/kASOi</b> on line <b>6</b><br />