3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Path { public $currentPath; private $array; function __construct($path) { $this->currentPath = $path; $array = explode("/", $path); } public function cd($newPath) { $change = explode("/", $newPath); foreach ($change as $value) { if ($value == "..") { if (count($array) > 0) { array_pop($array); } } else { array_push($array, $value); } } $currentPath = implode("/", $array); } } $path = new Path('/a/b/c/d'); echo $path->cd('../x')->currentPath;

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.60.0110.00716.50
8.3.50.0150.00018.06
8.3.40.0140.00419.03
8.3.30.0110.01118.92
8.3.20.0000.00720.34
8.3.10.0030.00623.61
8.3.00.0060.00319.51
8.2.180.0100.01018.29
8.2.170.0090.00922.96
8.2.160.0100.00320.52
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0080.00020.16
8.2.120.0040.00426.35
8.2.110.0100.00020.94
8.2.100.0080.00417.66
8.2.90.0000.00819.23
8.2.80.0040.00417.97
8.2.70.0000.00817.61
8.2.60.0040.00417.68
8.2.50.0000.00818.07
8.2.40.0000.00921.13
8.2.30.0040.00420.70
8.2.20.0040.00417.70
8.2.10.0040.00418.09
8.2.00.0050.00218.16
8.1.280.0070.01125.92
8.1.270.0090.00623.97
8.1.260.0000.00728.09
8.1.250.0070.00028.09
8.1.240.0120.00622.42
8.1.230.0080.00421.02
8.1.220.0040.00417.80
8.1.210.0050.00318.77
8.1.200.0060.00317.47
8.1.190.0070.00017.58
8.1.180.0040.00418.10
8.1.170.0050.00318.59
8.1.160.0000.00721.99
8.1.150.0080.00018.82
8.1.140.0090.00019.61
8.1.130.0030.00317.66
8.1.120.0050.00217.49
8.1.110.0030.00517.49
8.1.100.0070.00017.50
8.1.90.0040.00417.32
8.1.80.0040.00417.37
8.1.70.0000.00817.32
8.1.60.0000.01117.61
8.1.50.0090.00017.53
8.1.40.0030.00617.43
8.1.30.0000.00817.67
8.1.20.0040.00417.56
8.1.10.0000.00817.58
8.1.00.0040.00417.54
8.0.300.0050.00520.04
8.0.290.0040.00416.75
8.0.280.0030.00318.52
8.0.270.0070.00017.36
8.0.260.0000.00717.31
8.0.250.0000.00617.04
8.0.240.0080.00017.05
8.0.230.0000.00717.04
8.0.220.0030.00316.81
8.0.210.0000.00716.95
8.0.200.0000.00617.09
8.0.190.0040.00417.08
8.0.180.0050.00316.89
8.0.170.0050.00317.00
8.0.160.0030.00317.00
8.0.150.0040.00417.00
8.0.140.0070.00416.83
8.0.130.0000.00713.44
8.0.120.0030.00517.00
8.0.110.0080.00017.01
8.0.100.0040.00416.83
8.0.90.0040.00416.78
8.0.80.0000.02316.97
8.0.70.0000.00817.01
8.0.60.0000.00716.95
8.0.50.0000.00716.87
8.0.30.0060.01117.17
8.0.20.0120.00917.45
8.0.10.0000.00717.06
8.0.00.0090.00916.76
7.4.330.0050.00016.78
7.4.320.0000.00816.38
7.4.300.0030.00316.62
7.4.290.0030.00316.42
7.4.280.0060.00316.50
7.4.270.0040.00416.54
7.4.260.0030.00316.46
7.4.250.0070.00016.55
7.4.240.0060.00216.54
7.4.230.0040.00416.40
7.4.220.0060.01316.62
7.4.210.0120.00916.55
7.4.200.0050.00316.69
7.4.160.0060.00916.62
7.4.150.0100.01317.40
7.4.140.0090.01017.86
7.4.130.0110.00816.50
7.4.120.0140.00316.57
7.4.110.0100.00716.62
7.4.100.0030.01516.55
7.4.90.0100.00716.64
7.4.80.0220.00319.39
7.4.70.0220.02516.71
7.4.60.0040.01216.40
7.4.50.0040.00816.54
7.4.40.0170.00016.64
7.4.30.0160.00616.63
7.4.00.0090.00615.19
7.3.330.0000.00713.13
7.3.320.0000.00513.39
7.3.310.0070.00016.32
7.3.300.0030.00316.38
7.3.290.0080.00716.33
7.3.280.0080.00816.38
7.3.270.0110.00717.40
7.3.260.0190.00616.69
7.3.250.0090.01216.30
7.3.240.0090.01016.32
7.3.230.0150.00316.56
7.3.210.0120.00316.59
7.3.200.0030.01316.20
7.3.190.0030.01316.50
7.3.180.0100.01016.32
7.3.170.0070.01016.53
7.3.160.0060.01316.68
7.3.10.0120.00616.38
7.3.00.0110.00316.30
7.2.330.0080.01916.86
7.2.320.0060.01016.47
7.2.310.0170.00316.41
7.2.300.0030.01416.47
7.2.290.0110.01016.46
7.2.130.0150.00016.45
7.2.120.0160.00016.24
7.2.110.0070.01116.22
7.2.100.0110.00616.16
7.2.90.0100.01016.77
7.2.80.0160.00316.81
7.2.70.0000.00916.66
7.2.60.0070.00816.76
7.2.50.0060.00616.68
7.2.40.0220.00316.44
7.2.30.0030.01316.77
7.2.20.0130.01316.55
7.2.10.0160.00316.91
7.2.00.0080.00717.98
7.1.250.0070.00715.34
7.1.200.0090.00315.59
7.1.100.0030.01018.13
7.1.70.0000.00716.95
7.1.60.0030.01319.36
7.1.50.0110.00734.83
7.1.00.0000.08022.42
7.0.200.0000.01016.78
7.0.60.0030.07019.80
7.0.50.0070.08017.85
7.0.40.0170.05720.04
7.0.30.0200.06320.15
7.0.20.0200.04320.15
7.0.10.0100.05720.11
7.0.00.0100.04020.26
5.6.280.0000.03320.80
5.6.210.0030.07320.68
5.6.200.0070.06318.19
5.6.190.0030.04320.67
5.6.180.0430.05020.63
5.6.170.0200.04320.54
5.6.160.0070.08720.44
5.6.150.0100.05018.25
5.6.140.0030.08318.17
5.6.130.0030.04018.15
5.6.120.0070.03721.04
5.6.110.0170.06321.08
5.6.100.0030.05021.08
5.6.90.0100.07321.13
5.6.80.0130.07320.37
5.5.350.0230.05720.40
5.5.340.0000.04318.08
5.5.330.0070.06320.23
5.5.320.0000.07020.20
5.5.310.0200.04020.30
5.5.300.0100.07017.98
5.5.290.0100.06317.97
5.5.280.0170.05720.88
5.5.270.0030.04020.73
5.5.260.0130.05320.80
5.5.250.0030.08320.62
5.5.240.0370.05320.08

preferences:
65.06 ms | 400 KiB | 5 Q