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; }

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
7.0.10.0170.07320.21
7.0.00.0070.06320.25
5.6.160.0100.07720.55
5.6.150.0070.06718.12
5.6.140.0100.05018.21
5.6.130.0000.06018.18
5.6.120.0030.07720.94
5.6.110.0000.09321.11
5.6.100.0030.07021.12
5.6.90.0070.08021.13
5.6.80.0070.03320.50
5.5.300.0030.05318.05
5.5.290.0070.05718.02
5.5.280.0100.08320.68
5.5.270.0100.08020.86
5.5.260.0130.07720.77
5.5.250.0000.08020.61
5.5.240.0200.02320.16

preferences:
140.37 ms | 1394 KiB | 7 Q