3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = 'Showing results [program=for {program} programs|No pogram at all] [province=in {province}] [degree=with degree of {degree}]'; function interpolateString($message, array $context = array()) { $replace = array(); foreach ($context as $key => $val) { $replace['{' . $key . '}'] = $val; } return strtr($message, $replace); } $arrContext = array( 'program' => 'Nursing', 'province' => 'Ontario', 'degree' => false ); //echo interpolateString($str, $arrContext); echo "\n"; $arrMatches = array(); preg_match_all("/\[(\w+)\=([^\[\]\|.*]*)?\|*([^\[\].*]*)\]/", $str, $arrMatches); $contextKeys = $arrMatches[1]; foreach ($contextKeys as $key){ echo $key; }

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.0150.00718.43
8.3.50.0070.01222.17
8.3.40.0070.00718.93
8.3.30.0110.00418.97
8.3.20.0030.00518.85
8.3.10.0040.00420.59
8.3.00.0080.00023.48
8.2.180.0100.00316.63
8.2.170.0110.00322.96
8.2.160.0080.00520.30
8.2.150.0120.00624.18
8.2.140.0030.00524.66
8.2.130.0070.00026.16
8.2.120.0060.00319.61
8.2.110.0060.00321.12
8.2.100.0040.00817.59
8.2.90.0090.00019.22
8.2.80.0000.00818.02
8.2.70.0090.00017.75
8.2.60.0030.00517.93
8.2.50.0040.00418.07
8.2.40.0090.00018.04
8.2.30.0040.00419.83
8.2.20.0080.00017.76
8.2.10.0050.00317.97
8.2.00.0040.00417.94
8.1.280.0210.00025.92
8.1.270.0040.00423.99
8.1.260.0030.00526.35
8.1.250.0050.00328.09
8.1.240.0060.00621.81
8.1.230.0000.01021.03
8.1.220.0060.00318.77
8.1.210.0040.00418.97
8.1.200.0060.00317.35
8.1.190.0050.00317.40
8.1.180.0060.00318.10
8.1.170.0040.00418.62
8.1.160.0070.00018.84
8.1.150.0040.00418.72
8.1.140.0040.00417.63
8.1.130.0000.00717.74
8.1.120.0000.00717.53
8.1.110.0030.00517.50
8.1.100.0000.00717.49
8.1.90.0070.00017.53
8.1.80.0050.00317.69
8.1.70.0030.00617.61
8.1.60.0040.00417.64
8.1.50.0090.00017.59
8.1.40.0030.00517.74
8.1.30.0000.00817.82
8.1.20.0000.00817.71
8.1.10.0040.00417.70
8.1.00.0040.00417.66
8.0.300.0040.00420.10
8.0.290.0030.00317.16
8.0.280.0000.00818.48
8.0.270.0000.00717.29
8.0.260.0030.00317.00
8.0.250.0080.00017.09
8.0.240.0000.00917.01
8.0.230.0000.00817.12
8.0.220.0040.00417.05
8.0.210.0040.00416.93
8.0.200.0000.00617.02
8.0.190.0040.00417.02
8.0.180.0050.00317.03
8.0.170.0030.00616.96
8.0.160.0040.00417.05
8.0.150.0060.00317.04
8.0.140.0030.00617.00
8.0.130.0080.00013.49
8.0.120.0040.00416.86
8.0.110.0000.00817.11
8.0.100.0070.00017.10
8.0.90.0000.00717.12
8.0.80.0070.00717.05
8.0.70.0040.00417.06
8.0.60.0040.00417.07
8.0.50.0040.00417.02
8.0.30.0100.01217.43
8.0.20.0120.00617.40
8.0.10.0070.00016.98
8.0.00.0100.00916.89
7.4.330.0030.00314.93
7.4.320.0030.00316.71
7.4.300.0060.00016.68
7.4.290.0000.00716.75
7.4.280.0070.00016.75
7.4.270.0080.00016.63
7.4.260.0040.00413.54
7.4.250.0040.00416.79
7.4.240.0050.00316.69
7.4.230.0030.00316.59
7.4.220.0120.00816.68
7.4.210.0050.01016.77
7.4.200.0080.00016.83
7.4.190.0000.00716.64
7.4.160.0030.01316.63
7.4.150.0120.00817.40
7.4.140.0110.00717.86
7.4.130.0150.00316.86
7.4.120.0080.01016.70
7.4.110.0080.01116.70
7.4.100.0130.00316.59
7.4.90.0100.00716.77
7.4.80.0150.00419.37
7.4.70.0070.01016.59
7.4.60.0140.00716.71
7.4.50.0040.00416.70
7.4.40.0030.01222.27
7.4.30.0120.00616.76
7.4.00.0070.01015.29
7.3.330.0000.00513.45
7.3.320.0050.00013.51
7.3.310.0040.00416.59
7.3.300.0040.00416.39
7.3.290.0000.01416.40
7.3.280.0100.01016.44
7.3.270.0120.00617.40
7.3.260.0070.01018.24
7.3.250.0150.00616.76
7.3.240.0090.00916.77
7.3.230.0080.00916.70
7.3.210.0110.00816.71
7.3.200.0120.00819.39
7.3.190.0090.00916.42
7.3.180.0080.00816.52
7.3.170.0100.00916.47
7.3.160.0030.01416.54
7.3.120.0100.00614.70
7.2.330.0120.01216.69
7.2.320.0130.00316.86
7.2.310.0130.01216.85
7.2.300.0070.01116.83
7.2.290.0060.01016.97
7.2.60.0060.00617.18
7.2.00.0060.00619.60
7.1.200.0250.00615.66
7.1.100.0090.00317.96
7.1.70.0030.00517.43
7.1.60.0110.01419.40
7.1.50.0040.01917.23
7.1.00.0070.07322.46
7.0.200.0280.00414.89
7.0.140.0000.07322.13
7.0.60.0030.04019.82
7.0.50.0030.09317.90
7.0.40.0100.07720.21
7.0.30.0230.08720.18
7.0.20.0530.05320.17
7.0.10.0030.05720.16
7.0.00.0100.08720.08
5.6.280.0030.07320.99
5.6.210.0230.07020.47
5.6.200.0070.07718.23
5.6.190.0070.05720.68
5.6.180.0270.07720.63
5.6.170.0200.05320.39
5.6.160.0170.04720.57
5.6.150.0030.04018.14
5.6.140.0100.07318.18
5.6.130.0100.05318.25
5.6.120.0000.04721.13
5.6.110.0130.08021.14
5.6.100.0070.07020.89
5.6.90.0100.08020.95
5.6.80.0100.03320.50
5.5.350.0270.05320.35
5.5.340.0000.08317.99
5.5.330.0130.03320.47
5.5.320.0200.06720.24
5.5.310.0300.04320.36
5.5.300.0100.04317.93
5.5.290.0130.03318.03
5.5.280.0130.06020.67
5.5.270.0130.07320.78
5.5.260.0100.04320.80
5.5.250.0170.07020.47
5.5.240.0000.03320.07
5.4.450.3130.04719.17
5.4.440.3330.04719.28
5.4.430.3100.04319.39
5.4.420.3130.04319.41
5.4.410.3100.03719.35
5.4.400.3130.03719.25
5.4.390.2930.04319.17
5.4.380.3030.04019.17
5.4.370.3330.04019.30
5.4.360.2970.04019.06
5.4.350.2870.03319.22
5.4.340.3000.03318.84
5.4.320.3000.03719.20
5.4.310.3000.03718.97
5.4.300.3100.02319.16
5.4.290.3570.04018.83
5.4.280.2430.04319.22
5.4.270.2930.04318.99
5.4.260.2830.03019.01
5.4.250.2900.03319.12
5.4.240.3030.03319.21
5.4.230.2830.03319.20
5.4.220.2470.04018.83
5.4.210.2730.04019.23
5.4.200.3000.04018.83
5.4.190.3600.04019.21
5.4.180.3300.04019.18
5.4.170.2830.04019.08
5.4.160.2830.03719.07
5.4.150.3130.04719.20
5.4.140.2870.04316.36
5.4.130.3370.03316.37
5.4.120.3300.03716.32
5.4.110.2930.04016.45
5.4.100.3200.03716.56
5.4.90.3270.03016.56
5.4.80.3300.04016.22
5.4.70.3170.03016.44
5.4.60.3200.03716.54
5.4.50.2900.03716.25
5.4.40.3200.03716.33
5.4.30.3170.03316.53
5.4.20.3300.02716.42
5.4.10.3400.03316.33
5.4.00.2800.04015.78
5.3.290.3130.03714.67
5.3.280.3500.04014.57
5.3.270.3300.05014.58
5.3.260.3200.03714.52
5.3.250.3370.04314.62
5.3.240.3330.04714.72
5.3.230.3130.04014.61
5.3.220.2870.03714.49
5.3.210.3030.04314.47
5.3.200.2870.03714.48
5.3.190.3370.04014.71
5.3.180.3400.03014.53
5.3.170.3130.03714.68
5.3.160.3300.04314.57
5.3.150.2870.04014.63
5.3.140.3300.03714.64
5.3.130.2900.03314.61
5.3.120.2870.03014.79
5.3.110.3170.03714.70
5.3.100.2930.03313.94
5.3.90.3130.03714.07
5.3.80.2930.03714.17
5.3.70.2830.03313.93
5.3.60.3200.03313.91
5.3.50.3330.04014.11
5.3.40.3200.03013.96
5.3.30.3070.04013.83
5.3.20.2670.03313.59
5.3.10.2800.04013.66
5.3.00.2900.02713.55
5.2.170.2700.02711.38
5.2.160.2800.03011.33
5.2.150.2700.02711.33
5.2.140.2400.02711.33
5.2.130.2770.03011.33
5.2.120.2600.03011.33
5.2.110.2700.02711.34
5.2.100.1930.03011.33
5.2.90.2400.02711.33
5.2.80.2370.03011.33
5.2.70.2400.03011.33
5.2.60.2570.02711.33
5.2.50.2730.02311.33
5.2.40.2170.03011.33
5.2.30.2100.03311.33
5.2.20.2170.03711.33
5.2.10.2270.03011.33
5.2.00.2270.01711.33
5.1.60.1930.03011.33
5.1.50.1930.02311.33
5.1.40.2100.02311.33
5.1.30.2200.02711.33
5.1.20.2170.02311.33
5.1.10.1830.03311.33
5.1.00.2070.03011.33
5.0.50.0970.02011.33
5.0.40.1100.02011.33
5.0.30.1200.03011.33
5.0.20.1170.01711.33
5.0.10.1200.02711.33
5.0.00.1230.03711.33
4.4.90.0930.01711.33
4.4.80.1200.01711.33
4.4.70.1130.01011.33
4.4.60.1200.02011.33
4.4.50.0970.01711.33
4.4.40.1230.02711.33
4.4.30.0970.01711.33
4.4.20.1200.02011.33
4.4.10.1070.01711.33
4.4.00.1000.02311.33
4.3.110.0930.01711.33
4.3.100.1000.01311.33
4.3.90.1070.02011.33
4.3.80.0930.02711.33
4.3.70.1130.01711.33
4.3.60.1170.01311.33
4.3.50.1230.01711.33
4.3.40.1030.02011.33
4.3.30.0670.02011.33
4.3.20.0570.01711.33
4.3.10.0470.01711.33
4.3.00.0600.02011.33

preferences:
50.27 ms | 401 KiB | 5 Q