3v4l.org

run code in 300+ PHP versions simultaneously
<?php //initial test setup mkdir($a = sys_get_temp_dir() . '/A'); mkdir($b = sys_get_temp_dir() . '/A/B'); mkdir($c = sys_get_temp_dir() . '/A/B/C'); $template = <<<EOL <?php var_dump(__FILE__); EOL; $incTemplate = <<<EOL <?php include '../do_a.php'; include '../do_b.php'; EOL; file_put_contents($b . '/do_a.php', $template); file_put_contents($b . '/do_b.php', $template); file_put_contents($c . '/do.php', $incTemplate); ini_set('display_errors', 'on'); ini_set('error_reporting', -1); //end test setup if ($doAllThings = realpath($c . '/do.php')) { include $doAllThings; //warnings echo '---------------------' . PHP_EOL; chdir(dirname($doAllThings)); include $doAllThings; }

preferences:
27.44 ms | 411 KiB | 5 Q