3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php file_put_contents('/tmp/1.txt', 'test'); echo file_get_contents('/tmp/1.txt'); function rec($dir, $depth) { $d = dir($dir); if (!$d) return; while ($entry = $d->read()) { if ($entry == '.' || $entry == '..') continue; echo $depth . $entry . "\n"; if (is_dir($dir . '/' . $entry)) { //rec($dir . '/' . $entry, $depth . " "); } } } rec('/opt', '');
based on r9LZq
Output for 5.0.0 - 5.5.32, 5.5.34 - 5.6.17, 5.6.20 - 7.0.3, 7.0.5 - 7.1.0
test
Output for 5.5.33, 5.6.18 - 5.6.19, 7.0.4
test Warning: dir(/opt): failed to open dir: Permission denied in /in/BXF02 on line 5
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: file_put_contents() in /in/BXF02 on line 2
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: file_put_contents() in /in/BXF02 on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: file_put_contents() in /in/BXF02 on line 2