3v4l.org

run code in 300+ PHP versions simultaneously
<?php public function make_path2($curr_dir, $path) { $this->error = ""; $result = "/"; if ($path[0] === "/") { $path = substr($path, 1); } else { $path = substr($curr_dir, 1).'/'.$path; } if ($path) { $splitpath=explode("/", $path); foreach ($splitpath as $pathticle) { switch($pathticle) { case ".." : $result = dirname($result); // if second char of $result is not set, then current result is the rootNode if (isset($result[1])) { $result .= "/"; } $result[0] = "/"; // make sure that even under windows, slashes are always forward slashes. break; case "." : break; case "" : break; default: $result .= $pathticle."/"; break; } } } return $result; }
Output for 7.0.0 - 7.0.1
Parse error: syntax error, unexpected 'public' (T_PUBLIC), expecting end of file in /in/rSuAa on line 3
Process exited with code 255.
Output for 5.5.24 - 5.5.30, 5.6.8 - 5.6.16
Parse error: syntax error, unexpected 'public' (T_PUBLIC) in /in/rSuAa on line 3
Process exited with code 255.

preferences:
169.71 ms | 1395 KiB | 25 Q