3v4l.org

run code in 300+ PHP versions simultaneously
<?php $Ucountries = ["Uganda", "Ukraine", "United Arab Emirates (UAE)", "United Kingdom (UK)", "United States of America (USA)", "Uruguay", "Uzbekistan"]; $Mcountries = ["Macedonia (FYROM)", "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands", "Mauritania", "Mauritius", "Mexico", "Micronesia", "Moldova", "Monaco", "Mongolia", "Montenegro", "Morocco", "Mozambique", "Myanmar (Burma)"]; $str = "countries_mexico_mexico_city"; //$str = "countries_united_states_ohio"; $str = str_replace("countries_", "", $str); // Copy array needed to $CountryList $CountryList = ${strtoupper(substr($str,0,1)). "countries"}; $countryarr = array(); $arr = explode("_", $str); Foreach($arr as $val){ Foreach($CountryList as $item){ If(stripos($item, $val) !== false){ If(!in_array($val, $countryarr)){ $countryarr[] = $val; } } } } $country = implode(" ", $countryarr); $state_city = preg_replace("/" . implode("_",$countryarr) . "/", "", $str,1); $state_city = trim(str_replace("_", " ", $state_city)); Echo $country . "\n" . $state_city;

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.4.10.0000.01217.75
8.3.140.0150.00317.18
8.3.130.0050.00318.53
8.3.120.0040.00420.85
8.3.110.0060.00320.94
8.3.100.0110.00016.76
8.3.90.0100.00026.77
8.3.80.0090.00017.00
8.3.70.0110.00716.58
8.3.60.0070.01118.39
8.3.50.0100.00518.56
8.3.40.0070.00719.09
8.3.30.0060.00918.82
8.3.20.0040.00420.30
8.3.10.0000.00722.04
8.3.00.0040.00420.74
8.2.260.0040.00416.83
8.2.250.0030.00516.80
8.2.240.0000.00917.14
8.2.230.0040.00422.58
8.2.220.0050.00524.06
8.2.210.0050.00326.77
8.2.200.0030.00618.66
8.2.190.0140.00716.75
8.2.180.0140.00725.92
8.2.170.0120.00319.04
8.2.160.0140.00722.96
8.2.150.0050.00325.66
8.2.140.0080.00024.66
8.2.130.0040.00419.28
8.2.120.0050.00226.35
8.2.110.0090.00319.26
8.2.100.0030.00917.76
8.2.90.0000.00819.20
8.2.80.0000.00818.05
8.2.70.0060.00317.75
8.2.60.0000.00817.93
8.2.50.0040.00417.93
8.2.40.0040.00719.48
8.2.30.0040.00419.44
8.2.20.0080.00018.23
8.2.10.0030.00618.07
8.2.00.0040.00418.27
8.1.300.0040.00418.68
8.1.290.0030.00630.84
8.1.280.0070.01325.92
8.1.270.0080.00022.11
8.1.260.0050.00326.35
8.1.250.0070.00028.09
8.1.240.0080.00323.73
8.1.230.0090.00322.59
8.1.220.0050.00317.78
8.1.210.0080.00018.77
8.1.200.0090.00017.47
8.1.190.0050.00317.36
8.1.180.0030.00618.10
8.1.170.0050.00317.70
8.1.160.0040.00418.95
8.1.150.0040.00420.28
8.1.140.0000.00819.63
8.1.130.0030.00520.63
8.1.120.0000.00717.66
8.1.110.0040.00417.61
8.1.100.0000.00717.54
8.1.90.0030.00517.68
8.1.80.0000.00817.62
8.1.70.0070.00017.64
8.1.60.0030.00617.76
8.1.50.0040.00817.72
8.1.40.0000.00917.64
8.1.30.0040.00417.82
8.1.20.0000.00817.73
8.1.10.0000.00817.59
8.1.00.0040.00417.63
8.0.300.0000.00718.77
8.0.290.0000.00717.00
8.0.280.0030.00318.48
8.0.270.0030.00317.25
8.0.260.0040.00418.96
8.0.250.0070.00017.03
8.0.240.0000.00717.03
8.0.230.0030.00317.06
8.0.220.0000.00717.04
8.0.210.0030.00317.03
8.0.200.0000.00717.13
8.0.190.0090.00017.05
8.0.180.0060.00317.08
8.0.170.0000.00716.98
8.0.160.0040.00417.04
8.0.150.0080.00016.97
8.0.140.0000.01016.93
8.0.130.0030.00313.50
8.0.120.0040.00417.09
8.0.110.0000.00716.89
8.0.100.0040.00417.04
8.0.90.0000.00717.12
8.0.80.0110.00416.99
8.0.70.0050.00217.13
8.0.60.0000.00816.89
8.0.50.0020.00516.95
8.0.30.0100.01017.22
8.0.20.0090.01017.40
8.0.10.0030.00517.02
8.0.00.0100.00717.06
7.4.330.0050.00015.55
7.4.320.0040.00416.77
7.4.300.0000.00616.68
7.4.290.0040.00416.63
7.4.280.0070.00016.81
7.4.270.0030.00316.72
7.4.260.0000.00716.73
7.4.250.0080.00016.63
7.4.240.0000.00816.73
7.4.230.0000.00816.73
7.4.220.0120.00616.85
7.4.210.0110.00416.80
7.4.200.0030.00516.81
7.4.160.0060.01016.74
7.4.150.0030.01517.40
7.4.140.0130.00417.86
7.4.130.0060.01116.59
7.4.120.0130.00816.82
7.4.110.0100.00716.52
7.4.100.0030.01316.68
7.4.90.0120.00616.51
7.4.80.0140.00319.39
7.4.70.0100.00716.64
7.4.60.0080.00816.68
7.4.50.0030.01316.64
7.4.40.0070.01016.56
7.4.30.0150.00316.86
7.4.10.0070.00715.12
7.4.00.0050.01315.01
7.3.330.0000.00513.15
7.3.320.0030.00313.27
7.3.310.0040.00416.43
7.3.300.0000.00716.43
7.3.290.0020.01216.44
7.3.280.0090.00916.45
7.3.270.0070.01017.40
7.3.260.0090.00716.69
7.3.250.0120.00616.71
7.3.240.0100.00716.68
7.3.230.0100.01616.82
7.3.210.0060.01016.70
7.3.200.0100.00716.89
7.3.190.0060.01016.52
7.3.180.0070.01616.86
7.3.170.0100.00716.45
7.3.160.0080.00816.53
7.3.130.0060.01215.21
7.3.120.0090.00714.75
7.3.110.0100.00815.19
7.3.100.0120.00215.09
7.3.90.0120.00515.02
7.3.80.0070.00814.90
7.3.70.0030.01214.90
7.3.60.0030.00814.77
7.3.50.0090.00315.04
7.3.40.0050.00814.98
7.3.30.0030.00815.07
7.3.20.0030.00816.93
7.3.10.0050.00816.99
7.3.00.0060.00816.75
7.2.330.0110.00816.93
7.2.320.0110.00716.96
7.2.310.0050.01116.72
7.2.300.0130.00316.77
7.2.290.0090.01216.82
7.2.260.0000.01315.27
7.2.250.0060.01015.35
7.2.240.0080.01015.33
7.2.230.0110.00415.31
7.2.220.0070.00615.34
7.2.210.0050.00714.95
7.2.200.0070.00915.20
7.2.190.0080.00815.31
7.2.180.0030.01015.17
7.2.170.0030.00915.14
7.2.160.0070.00715.39
7.2.150.0030.00717.32
7.2.140.0090.00317.14
7.2.130.0060.00917.12
7.2.120.0070.00817.05
7.2.110.0030.01017.07
7.2.100.0060.00516.96
7.2.90.0020.01017.29
7.2.80.0040.00717.19
7.2.70.0050.00817.03
7.2.60.0070.00517.07
7.2.50.0100.00517.16
7.2.40.0070.00517.18
7.2.30.0040.00817.14
7.2.20.0060.00717.07
7.2.10.0030.01116.96
7.2.00.0080.00517.23
7.1.330.0060.00816.05
7.1.320.0090.00515.93
7.1.310.0040.01215.83
7.1.300.0060.00715.83
7.1.290.0030.01016.00
7.1.280.0050.00915.91
7.1.270.0030.00816.02
7.1.260.0100.00316.00
7.1.250.0070.00715.85
7.1.240.0060.00416.11
7.1.230.0040.00615.67
7.1.220.0080.00415.94
7.1.210.0030.00815.87
7.1.200.0050.00915.79
7.1.190.0020.00916.09
7.1.180.0060.00715.96
7.1.170.0060.00815.93
7.1.160.0020.01316.07
7.1.150.0070.00716.04
7.1.140.0040.01015.94
7.1.130.0060.00615.76
7.1.120.0060.00515.89
7.1.110.0020.01015.90
7.1.100.0090.00415.92
7.1.90.0070.00615.81
7.1.80.1360.00916.09
7.1.70.1350.00915.93
7.1.60.1230.00921.65
7.1.50.1100.01021.55
7.1.40.1050.01521.44
7.1.30.1380.01021.45
7.1.20.1130.01021.47
7.1.10.1060.00915.50
7.1.00.0930.00515.70
7.0.330.0050.00615.64
7.0.320.0090.00515.66
7.0.310.0020.01115.58
7.0.300.0080.00515.56
7.0.290.0030.00815.81
7.0.280.0040.00915.58
7.0.270.0050.00815.67
7.0.260.0060.00515.41
7.0.250.0060.00615.52
7.0.240.0030.00815.68
7.0.230.0030.01215.55
7.0.220.0030.01115.76
7.0.210.0070.00715.63
7.0.200.1540.00615.55
7.0.190.1370.00715.49
7.0.180.1110.01115.40
7.0.170.1610.00815.28
7.0.160.1510.01015.24
7.0.150.1250.01115.21
7.0.140.1240.01215.38
7.0.130.1280.01215.36
7.0.120.1190.01215.39
7.0.110.1360.00815.30
7.0.100.1480.00515.28
7.0.90.1260.00915.32
7.0.80.1500.00715.37
7.0.70.1230.01115.35
7.0.60.0940.01215.36
7.0.50.1100.00915.31
7.0.40.0980.00813.97
7.0.30.0060.01113.92
7.0.20.0090.00614.06
7.0.10.0060.00914.12
7.0.00.1490.00614.03
5.6.400.0070.00714.71
5.6.390.0000.01514.75
5.6.380.0050.00914.50
5.6.370.0030.01014.81
5.6.360.0130.00314.92
5.6.350.0000.01414.04
5.6.340.0030.01014.70
5.6.330.0070.00714.41
5.6.320.0100.00314.51
5.6.310.0140.00014.50
5.6.300.0070.01014.61
5.6.290.0100.00714.46
5.6.280.0060.00914.52
5.6.270.0070.01014.25
5.6.260.0040.00814.49
5.6.250.0060.00914.64
5.6.240.0030.01014.67
5.6.230.0000.01014.69
5.6.220.0090.00614.64
5.6.210.0060.00314.32
5.6.200.0090.00614.84
5.6.190.0030.01014.34
5.6.180.0030.00714.32
5.6.170.0050.00514.18
5.6.160.0080.00814.57
5.6.150.0040.00814.50
5.6.140.0140.00314.24
5.6.130.0110.00714.57
5.6.120.0030.00914.63
5.6.110.0060.01014.45
5.6.100.0060.00914.50
5.6.90.0000.01014.49
5.6.80.0030.01014.11
5.6.70.0030.01014.57
5.6.60.0060.00914.43
5.6.50.0030.00914.21
5.6.40.0030.01014.42
5.6.30.0030.01314.70
5.6.20.0040.00414.42
5.6.10.0030.01314.41
5.6.00.0030.01014.43

preferences:
70.55 ms | 403 KiB | 5 Q