3v4l.org

run code in 300+ PHP versions simultaneously
<?php static $root; if (!isset($root)) { $root = $_SERVER['DOCUMENT_ROOT']; if ( substr( $root, -1, 1 ) != '/' ) { $root .= '/'; } } return $root; ?>

preferences:
45.75 ms | 402 KiB | 5 Q