3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Path { public $currentPath; private $array; function __construct( $path ) { $this->currentPath = $path; $this->array = array_slice( explode( "/", $path ), 1 ); } public function cd( $newPath ) { if ( $newPath == "" || $newPath == "." ) { return $this; } $change = explode( "/", $newPath ); foreach ( $change as $value ) { if ( $value == ".." ) { if ( count( $this->array ) > 0 ) { array_pop($this->array); } } elseif ( $value !== "" ) { array_push( $this->array, $value ); } } if ( count( $this->array ) > 0 ) { $this->currentPath = "/" + implode( "/", $this->array ); } else { $this->currentPath = "/"; } return $this; } } $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.40.0060.00918.59
8.3.30.0080.00818.79
8.3.20.0070.00020.16
8.3.10.0040.00423.65
8.3.00.0050.00319.38
8.2.170.0150.00022.96
8.2.160.0060.01020.28
8.2.150.0090.00024.18
8.2.140.0040.00424.66
8.2.130.0050.00320.52
8.2.120.0040.00426.35
8.2.110.0060.00321.13
8.2.100.0040.00817.93
8.2.90.0080.00019.20
8.2.80.0080.00017.97
8.2.70.0050.00317.38
8.2.60.0030.00618.04
8.2.50.0040.00418.07
8.2.40.0040.00420.89
8.2.30.0060.00320.69
8.2.20.0070.00017.70
8.2.10.0000.00717.94
8.2.00.0020.00517.94
8.1.270.0100.01023.86
8.1.260.0000.00728.09
8.1.250.0080.00028.09
8.1.240.0070.00319.12
8.1.230.0060.00617.66
8.1.220.0040.00417.75
8.1.210.0040.00418.77
8.1.200.0060.00317.13
8.1.190.0090.00017.70
8.1.180.0050.00318.10
8.1.170.0040.00418.53
8.1.160.0000.00722.12
8.1.150.0050.00318.86
8.1.140.0030.00719.58
8.1.130.0040.00417.77
8.1.120.0000.00717.46
8.1.110.0080.00017.43
8.1.100.0070.00017.46
8.1.90.0000.00717.35
8.1.80.0000.00717.46
8.1.70.0040.00417.31
8.1.60.0000.00817.55
8.1.50.0040.00417.42
8.1.40.0040.00417.54
8.1.30.0000.01017.54
8.1.20.0030.00617.68
8.1.10.0000.00717.49
8.1.00.0040.00417.55
8.0.300.0000.00818.77
8.0.290.0000.00716.88
8.0.280.0030.00318.39
8.0.270.0030.00317.20
8.0.260.0050.00317.18
8.0.250.0000.00717.06
8.0.240.0050.00217.01
8.0.230.0000.00717.01
8.0.220.0030.00316.95
8.0.210.0040.00416.93
8.0.200.0030.00317.04
8.0.190.0080.00017.01
8.0.180.0040.00416.97
8.0.170.0040.00416.93
8.0.160.0000.00716.86
8.0.150.0040.00416.86
8.0.140.0000.00916.97
8.0.130.0060.00013.37
8.0.120.0070.00016.82
8.0.110.0050.00216.86
8.0.100.0000.00817.00
8.0.90.0000.00716.98
8.0.80.0150.00416.98
8.0.70.0000.00716.99
8.0.60.0070.00017.07
8.0.50.0040.00416.86
8.0.30.0100.01017.08
8.0.20.0050.01417.40
8.0.10.0000.00716.98
8.0.00.0090.01216.81
7.4.330.0030.00316.69
7.4.320.0050.00316.47
7.4.300.0030.00316.36
7.4.290.0030.00316.56
7.4.280.0030.00616.61
7.4.270.0030.00316.57
7.4.260.0080.00316.48
7.4.250.0000.00716.48
7.4.240.0030.00516.54
7.4.230.0030.00316.63
7.4.220.0090.00916.63
7.4.210.0110.00416.55
7.4.200.0040.00416.35
7.4.160.0070.01016.75
7.4.150.0190.00017.40
7.4.140.0100.01217.86
7.4.130.0090.01016.57
7.4.120.0090.00816.55
7.4.110.0090.01816.54
7.4.100.0060.01816.71
7.4.90.0120.00916.61
7.4.80.0130.00619.39
7.4.70.0130.00616.51
7.4.60.0130.00316.61
7.4.50.0060.01016.25
7.4.40.0030.01616.52
7.4.30.0150.00616.57
7.4.00.0130.00314.77
7.3.330.0040.00413.23
7.3.320.0000.00513.38
7.3.310.0030.00316.43
7.3.300.0050.00316.39
7.3.290.0060.01116.37
7.3.280.0080.00816.39
7.3.270.0120.00617.40
7.3.260.0160.00616.72
7.3.250.0080.00916.47
7.3.240.0070.01016.64
7.3.230.0070.01016.52
7.3.210.0060.01116.35
7.3.200.0120.00616.28
7.3.190.0060.01116.44
7.3.180.0130.00316.76
7.3.170.0120.00616.39
7.3.160.0130.00316.46
7.2.330.0090.00916.81
7.2.320.0140.00316.59
7.2.310.0100.00716.79
7.2.300.0140.00316.78
7.2.290.0080.00816.58
7.2.60.0040.00716.85
7.2.00.0070.00719.54
7.1.200.0000.00715.87
7.1.100.0030.00918.01
7.1.70.0030.01217.28
7.1.60.0070.01819.36
7.1.50.0200.01334.96
7.1.00.0000.07722.43
7.0.200.0030.00516.52
7.0.60.0130.05719.87
7.0.50.0070.05317.91
7.0.40.0030.07720.13
7.0.30.0230.06320.07
7.0.20.0130.04320.25
7.0.10.0100.05720.23
7.0.00.0100.08020.06
5.6.280.0000.06721.11
5.6.210.0030.08020.52
5.6.200.0130.07718.18
5.6.190.0070.04020.50
5.6.180.0330.04320.33
5.6.170.0270.03720.50
5.6.160.0100.07720.55
5.6.150.0070.06018.21
5.6.140.0070.08018.15
5.6.130.0100.07018.14
5.6.120.0130.08021.02
5.6.110.0100.05021.09
5.6.100.0030.08020.91
5.6.90.0100.07021.00
5.6.80.0030.08720.50
5.5.350.0170.05720.31
5.5.340.0070.07317.96
5.5.330.0100.04720.25
5.5.320.0030.08320.27
5.5.310.0130.04720.41
5.5.300.0100.07717.94
5.5.290.0030.08317.95
5.5.280.0070.03720.66
5.5.270.0170.06320.80
5.5.260.0070.06020.80
5.5.250.0170.08020.69
5.5.240.0130.04020.20

preferences:
50.61 ms | 400 KiB | 5 Q