3v4l.org

run code in 300+ PHP versions simultaneously
<?php 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)
8.3.70.0120.00318.43
8.3.60.0000.01518.68
8.3.50.0120.00721.99
8.3.40.0040.01118.97
8.3.30.0000.01420.39
8.3.20.0040.00420.32
8.3.10.0000.00821.97
8.3.00.0000.00822.38
8.2.180.0140.00416.75
8.2.170.0140.00022.96
8.2.160.0070.00720.35
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0000.00826.16
8.2.120.0050.00319.79
8.2.110.0040.00720.45
8.2.100.0080.00417.91
8.2.90.0060.00319.11
8.2.80.0030.00617.97
8.2.70.0050.00317.63
8.2.60.0040.00418.05
8.2.50.0030.00618.10
8.2.40.0000.00818.33
8.2.30.0000.01018.16
8.2.20.0000.00717.73
8.2.10.0040.00417.68
8.2.00.0060.00617.82
8.1.280.0110.00325.92
8.1.270.0000.00824.66
8.1.260.0040.00426.35
8.1.250.0090.00028.09
8.1.240.0060.00320.44
8.1.230.0110.00017.83
8.1.220.0040.00417.79
8.1.210.0040.00418.77
8.1.200.0060.00317.48
8.1.190.0030.00617.23
8.1.180.0050.00518.10
8.1.170.0060.00318.54
8.1.160.0070.00022.18
8.1.150.0040.00418.67
8.1.140.0040.00417.47
8.1.130.0070.00017.92
8.1.120.0060.00317.52
8.1.110.0040.00417.57
8.1.100.0000.00717.34
8.1.90.0030.00717.50
8.1.80.0000.00717.37
8.1.70.0000.00717.45
8.1.60.0060.00317.50
8.1.50.0040.00417.46
8.1.40.0030.00617.56
8.1.30.0000.00717.51
8.1.20.0040.00417.62
8.1.10.0020.00517.47
8.1.00.0080.00017.46
8.0.300.0040.00418.77
8.0.290.0040.00416.63
8.0.280.0000.00718.39
8.0.270.0040.00417.29
8.0.260.0040.00416.96
8.0.250.0110.00017.03
8.0.240.0040.00417.05
8.0.230.0070.00016.95
8.0.220.0080.00016.87
8.0.210.0040.00416.99
8.0.200.0030.00317.09
8.0.190.0050.00317.08
8.0.180.0040.00416.93
8.0.170.0000.00717.01
8.0.160.0000.00716.85
8.0.150.0030.00516.81
8.0.140.0040.00416.91
8.0.130.0050.00013.31
8.0.120.0050.00316.95
8.0.110.0040.00416.93
8.0.100.0000.00717.00
8.0.90.0000.00717.05
8.0.80.0120.00317.07
8.0.70.0000.00717.11
8.0.60.0050.00216.89
8.0.50.0070.00016.84
8.0.30.0130.00517.00
8.0.20.0110.00817.40
8.0.10.0030.00516.99
8.0.00.0100.01216.66
7.4.330.0000.00515.05
7.4.320.0030.00316.54
7.4.300.0040.00416.58
7.4.290.0030.00316.59
7.4.280.0070.00016.46
7.4.270.0070.00016.63
7.4.260.0060.00013.32
7.4.250.0000.00716.57
7.4.240.0020.00516.58
7.4.230.0000.00716.71
7.4.220.0060.01216.64
7.4.210.0090.00916.57
7.4.200.0050.00316.36
7.4.190.0000.00916.58
7.4.160.0060.01116.54
7.4.150.0100.01017.40
7.4.140.0060.01217.86
7.4.130.0140.00516.47
7.4.120.0140.00516.59
7.4.110.0130.00516.67
7.4.100.0090.01216.59
7.4.90.0070.01316.44
7.4.80.0090.00919.39
7.4.70.0090.00916.52
7.4.60.0100.00716.53
7.4.50.0040.00416.57
7.4.40.0000.01722.77
7.4.30.0030.01416.55
7.4.00.0060.00914.93
7.3.330.0000.00513.20
7.3.320.0000.00513.44
7.3.310.0080.00016.50
7.3.300.0000.00716.32
7.3.290.0100.00316.42
7.3.280.0080.01016.43
7.3.270.0100.00717.40
7.3.260.0100.00816.54
7.3.250.0100.00716.54
7.3.240.0120.00916.45
7.3.230.0000.01716.69
7.3.210.0150.00316.49
7.3.200.0130.00319.39
7.3.190.0130.01016.43
7.3.180.0030.01316.38
7.3.170.0060.01216.44
7.3.160.0130.00316.58
7.3.120.0070.01114.96
7.3.110.0140.00414.92
7.3.100.0030.01314.47
7.3.90.0060.00615.00
7.3.80.0100.00314.97
7.3.70.0000.01114.98
7.3.60.0040.00914.98
7.3.50.0080.00414.80
7.3.40.0060.00914.60
7.3.30.0070.00414.78
7.3.20.0090.00316.84
7.3.10.0110.00416.75
7.3.00.0110.00316.51
7.2.330.0060.01316.84
7.2.320.0050.01316.90
7.2.310.0120.00616.86
7.2.300.0120.00416.78
7.2.290.0070.01016.61
7.2.250.0120.00315.26
7.2.240.0130.00714.95
7.2.230.0060.00915.22
7.2.220.0060.00915.00
7.2.210.0030.01215.05
7.2.200.0080.00415.21
7.2.190.0110.00415.21
7.2.180.0060.01215.20
7.2.170.0060.00615.25
7.2.60.0030.01017.06
7.1.330.0040.01215.78
7.1.320.0050.00515.60
7.1.310.0060.00615.96
7.1.300.0130.00315.63
7.1.290.0130.00315.55
7.1.280.0090.00615.71
7.1.270.0030.00715.59
7.1.260.0060.00615.88
7.1.200.0100.01015.90
7.1.70.0030.00717.21
7.1.60.0070.01819.43
7.1.50.0060.00616.65
7.1.00.0030.03322.54
7.0.200.0090.00016.73
7.0.140.0100.06722.09
7.0.60.0070.05319.80
7.0.50.0030.08717.86
7.0.40.0070.08720.09
7.0.30.0230.03720.20
7.0.20.0170.05320.19
7.0.10.0100.06720.09
7.0.00.0030.07320.15
5.6.280.0030.07321.05
5.6.210.0100.07020.48
5.6.200.0130.07318.18
5.6.190.0170.07020.61
5.6.180.0230.04320.61
5.6.170.0230.03720.55
5.6.160.0030.08720.48
5.6.150.0100.08018.28
5.6.140.0070.04718.18
5.6.130.0070.09018.30
5.6.120.0100.05321.00
5.6.110.0030.08721.03
5.6.100.0070.08721.12
5.6.90.0100.07321.02
5.6.80.0030.05020.37
5.5.350.0070.04320.38
5.5.340.0070.08317.97
5.5.330.0130.07320.21
5.5.320.0030.05020.33
5.5.310.0300.05320.35
5.5.300.0070.08018.04
5.5.290.0200.07018.09
5.5.280.0100.08720.81
5.5.270.0070.05320.74
5.5.260.0170.07720.77
5.5.250.0070.08320.72
5.5.240.0170.07720.38
5.4.450.1400.03719.49
5.4.440.0970.03719.54
5.4.430.0630.07719.54
5.4.420.0300.04719.27
5.4.410.0900.07019.37
5.4.400.0530.03719.00
5.4.390.1270.04018.98
5.4.380.0770.05318.57
5.4.370.0230.05718.78
5.4.360.0370.05018.80
5.4.350.0400.04718.60
5.4.340.0330.06018.63
5.4.320.0070.04012.52
5.4.310.0120.03512.51
5.4.300.0060.03512.51
5.4.290.0090.03412.51
5.4.280.0040.03812.41
5.4.270.0070.03812.41
5.4.260.0090.04512.41
5.4.250.0060.04012.41
5.4.240.0100.07718.66
5.4.230.0030.05718.83
5.4.220.0100.05018.85
5.4.210.0100.05018.73
5.4.200.0130.04718.83
5.4.190.0070.05718.80
5.4.180.0030.05718.80
5.4.170.0130.05718.80
5.4.160.0130.04718.83
5.4.150.0270.07018.84
5.4.140.0130.04316.39
5.4.130.0130.05016.50
5.4.120.0070.05316.50
5.4.110.0100.05016.52
5.4.100.0100.04716.52
5.4.90.0070.04716.35
5.4.80.0170.04316.39
5.4.70.0070.05316.28
5.4.60.0100.06016.44
5.4.50.0070.04716.46
5.4.40.0070.05316.36
5.4.30.0130.05016.30
5.4.20.0070.05716.43
5.4.10.0030.06316.35
5.4.00.0230.05715.93
5.3.290.0050.04012.80
5.3.280.0100.04714.44
5.3.270.0100.05014.64
5.3.260.0170.04314.79
5.3.250.0100.05014.84
5.3.240.0030.05314.63
5.3.230.0100.04714.60
5.3.220.0100.05314.64
5.3.210.0100.05014.66
5.3.200.0070.05314.57
5.3.190.0070.05014.58
5.3.180.0100.05014.73
5.3.170.0000.05714.65
5.3.160.0100.05014.66
5.3.150.0030.05314.64
5.3.140.0070.07014.57
5.3.130.0030.06714.46
5.3.120.0070.08014.65
5.3.110.0170.06014.53
5.3.100.0030.05714.04
5.3.90.0030.05714.04
5.3.80.0100.05014.09
5.3.70.0100.05014.11
5.3.60.0070.06014.08
5.3.50.0100.04714.03
5.3.40.0070.05014.18
5.3.30.0030.05313.91
5.3.20.0100.04313.61
5.3.10.0070.04713.64
5.3.00.0100.04713.73
5.2.170.0100.03711.25
5.2.160.0070.03711.22
5.2.150.0170.03711.24
5.2.140.0030.04311.22
5.2.130.0130.03011.30
5.2.120.0070.03711.18
5.2.110.0130.03711.33
5.2.100.0000.04711.33
5.2.90.0070.05711.11
5.2.80.0070.04011.19
5.2.70.0070.04011.01
5.2.60.0100.03711.23
5.2.50.0070.04011.01
5.2.40.0070.05711.19
5.2.30.0030.04311.15
5.2.20.0130.03310.94
5.2.10.0070.03710.85
5.2.00.0000.04710.81
5.1.60.0070.03010.10
5.1.50.0030.03710.02
5.1.40.0070.0509.91
5.1.30.0030.03710.32
5.1.20.0030.03710.59
5.1.10.0100.03010.32
5.1.00.0070.0439.94
5.0.50.0070.0308.71
5.0.40.0030.0308.49
5.0.30.0030.0438.29
5.0.20.0030.0278.28
5.0.10.0070.0238.17
5.0.00.0070.0478.42
4.4.90.0030.0237.32
4.4.80.0030.0207.32
4.4.70.0070.0177.32
4.4.60.0030.0207.31
4.4.50.0000.0307.31
4.4.40.0030.0337.32
4.4.30.0030.0207.32
4.4.20.0070.0177.32
4.4.10.0070.0207.32
4.4.00.0030.0337.32
4.3.110.0030.0237.32
4.3.100.0000.0237.32
4.3.90.0030.0207.32
4.3.80.0030.0307.32
4.3.70.0030.0277.32
4.3.60.0000.0237.32
4.3.50.0030.0207.32
4.3.40.0070.0307.32
4.3.30.0070.0177.32
4.3.20.0070.0177.32
4.3.10.0030.0207.32
4.3.00.0130.02014.48

preferences:
50.38 ms | 401 KiB | 5 Q