3v4l.org

run code in 300+ PHP versions simultaneously
<?php public static function realPath2($path) { $isUnixPath = ((strlen($path) === 0) || ($path[0] !== '/')); // Checks if path is relative. if ((strpos($path, ':') === false) && ($isUnixPath === true)) { $path = getcwd() . DIRECTORY_SEPARATOR . $path; } // Resolve path parts (single dot, double dot and double delimiters). $path = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $path); $parts = array_filter(explode(DIRECTORY_SEPARATOR, $path), 'strlen'); $absolutes = array(); foreach ($parts as $part) { if (('.' === $part) || ('' === $part)) { continue; } if ('..' === $part) { array_pop($absolutes); } else { $absolutes[] = $part; } } $path = implode(DIRECTORY_SEPARATOR, $absolutes); // Resolve any symlinks. if ((file_exists($path) === true) && (linkinfo($path) > 0)) { $path = readlink($path); } if ($isUnixPath === false) { $path = '/' . $path; } return $path; } echo realPath2('phar://test.phar/a/b/./.././v/../file.txt');

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)
5.4.240.0050.03512.38
5.4.230.0070.03512.37
5.4.220.0100.03212.37
5.4.210.0070.03412.37
5.4.200.0070.03612.37
5.4.190.0080.03312.36
5.4.180.0080.03212.36
5.4.170.0050.03612.37
5.4.160.0050.03512.37
5.4.150.0060.03612.36
5.4.140.0040.03712.05
5.4.130.0070.03512.03
5.4.120.0040.03412.00
5.4.110.0060.03411.99
5.4.100.0080.03311.99
5.4.90.0040.03811.99
5.4.80.0060.03812.00
5.4.70.0060.04811.99
5.4.60.0070.03611.99
5.4.50.0050.03611.99
5.4.40.0030.03711.98
5.4.30.0050.03511.98
5.4.20.0070.03411.98
5.4.10.0040.03611.98
5.4.00.0060.03611.47
5.3.280.0060.03712.71
5.3.270.0040.04112.73
5.3.260.0080.03612.72
5.3.250.0050.03612.72
5.3.240.0040.03712.72
5.3.230.0040.03812.71
5.3.220.0040.03812.68
5.3.210.0050.03812.68
5.3.200.0070.03512.68
5.3.190.0050.03712.68
5.3.180.0070.03412.67
5.3.170.0060.03612.67
5.3.160.0060.03612.67
5.3.150.0050.03812.67
5.3.140.0070.03412.66
5.3.130.0050.03912.66
5.3.120.0070.03912.66
5.3.110.0050.03812.65
5.3.100.0070.03512.12
5.3.90.0080.03512.09
5.3.80.0040.03812.07
5.3.70.0050.03712.08
5.3.60.0060.03612.06
5.3.50.0050.03612.00
5.3.40.0050.03612.00
5.3.30.0060.03511.94
5.3.20.0070.03511.72
5.3.10.0070.03411.68
5.3.00.0050.03911.66

preferences:
143.75 ms | 1394 KiB | 7 Q