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); for ($i=0; $i<=count($arrMatches[1])-1;$i++) { if ($arrContext[$arrMatches[1][$i]] !== false) { $str = strstr($arrMatches[0][$i], $arrMatches[2][$i]); }else{ $str = strstr($arrMatches[0][$i], $arrMatches[2][$i]); } } echo $str;

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.0080.00819.18
8.3.30.0140.00019.09
8.3.20.0080.00020.35
8.3.10.0080.00022.10
8.3.00.0040.00422.40
8.2.170.0110.00422.96
8.2.160.0070.00721.20
8.2.150.0030.00524.18
8.2.140.0080.00024.66
8.2.130.0070.00026.16
8.2.120.0000.00819.50
8.2.110.0030.00622.22
8.2.100.0090.00319.70
8.2.90.0040.00419.26
8.2.80.0080.00017.97
8.2.70.0030.00617.75
8.2.60.0080.00017.93
8.2.50.0000.00818.07
8.2.40.0040.00418.16
8.2.30.0030.00618.28
8.2.20.0050.00317.84
8.2.10.0000.00817.95
8.2.00.0000.00817.93
8.1.270.0040.00423.88
8.1.260.0000.00826.35
8.1.250.0080.00028.09
8.1.240.0040.00423.90
8.1.230.0040.00819.11
8.1.220.0030.00517.91
8.1.210.0040.00418.77
8.1.200.0050.00517.48
8.1.190.0000.00817.66
8.1.180.0040.00418.10
8.1.170.0030.00618.61
8.1.160.0030.00622.10
8.1.150.0040.00418.87
8.1.140.0050.00217.61
8.1.130.0000.00717.96
8.1.120.0000.00717.58
8.1.110.0070.00017.66
8.1.100.0000.00917.56
8.1.90.0000.00717.66
8.1.80.0000.00817.65
8.1.70.0070.00017.63
8.1.60.0000.00817.78
8.1.50.0000.00717.71
8.1.40.0040.00417.66
8.1.30.0040.00417.80
8.1.20.0040.00417.77
8.1.10.0080.00017.75
8.1.00.0050.00217.57
8.0.300.0030.00618.77
8.0.290.0030.00617.04
8.0.280.0040.00418.44
8.0.270.0000.00717.35
8.0.260.0030.00317.07
8.0.250.0030.00317.15
8.0.240.0050.00317.05
8.0.230.0030.00317.07
8.0.220.0050.00317.10
8.0.210.0000.00716.92
8.0.200.0040.00417.11
8.0.190.0040.00417.06
8.0.180.0030.00517.05
8.0.170.0030.00517.14
8.0.160.0000.00717.16
8.0.150.0040.00417.04
8.0.140.0000.00717.04
8.0.130.0000.00613.50
8.0.120.0040.00417.01
8.0.110.0030.00517.18
8.0.100.0030.00517.20
8.0.90.0000.00717.05
8.0.80.0030.01417.14
8.0.70.0000.00717.15
8.0.60.0000.00716.99
8.0.50.0040.00416.98
8.0.30.0110.00817.28
8.0.20.0120.01117.41
8.0.10.0000.00717.09
8.0.00.0110.00817.04
7.4.330.0020.00215.12
7.4.320.0030.00316.80
7.4.300.0000.00616.72
7.4.290.0000.00816.86
7.4.280.0000.00716.79
7.4.270.0000.00816.79
7.4.260.0000.00716.89
7.4.250.0000.00716.67
7.4.240.0050.00216.77
7.4.230.0020.00516.88
7.4.220.0110.00916.77
7.4.210.0100.00516.85
7.4.200.0030.00316.89
7.4.190.0070.00016.94
7.4.160.0100.00716.66
7.4.150.0150.00317.40
7.4.140.0120.00617.86
7.4.130.0070.01316.71
7.4.120.0080.00916.80
7.4.110.0150.00316.72
7.4.100.0060.01216.89
7.4.90.0150.00316.77
7.4.80.0070.01019.39
7.4.70.0120.00316.77
7.4.60.0070.01016.86
7.4.50.0060.00016.71
7.4.40.0040.01122.77
7.4.30.0060.00916.57
7.4.00.0040.01015.14
7.3.330.0000.00513.53
7.3.320.0030.00313.35
7.3.310.0030.00316.60
7.3.300.0000.00716.42
7.3.290.0090.00616.57
7.3.280.0120.00616.54
7.3.270.0060.01317.40
7.3.260.0160.00616.61
7.3.250.0080.01016.64
7.3.240.0080.00816.72
7.3.230.0120.00616.51
7.3.210.0150.00916.46
7.3.200.0070.01319.39
7.3.190.0150.00416.76
7.3.180.0120.00416.48
7.3.170.0130.00316.82
7.3.160.0060.01016.55
7.3.120.0000.01615.02
7.2.330.0090.00916.84
7.2.320.0070.01117.00
7.2.310.0100.01016.88
7.2.300.0090.01216.92
7.2.290.0070.01316.88
7.2.00.0030.01319.74
7.1.100.0290.00417.81
7.1.70.0120.00317.40
7.1.60.0070.01719.82
7.1.50.0090.01317.16
7.1.00.0030.07322.54
7.0.200.0060.00916.93
7.0.140.0100.07022.16
7.0.80.0530.07319.97
7.0.70.0170.07019.94
7.0.60.0030.07720.04
7.0.50.0630.07020.21
7.0.40.0130.07720.00
7.0.30.0170.08020.13
7.0.20.0070.07319.95
7.0.10.0030.08019.99
7.0.00.0030.08720.02
5.6.280.0030.07020.78
5.6.230.0100.08020.64
5.6.220.0030.08020.66
5.6.210.0230.06720.65
5.6.200.0130.08021.13
5.6.190.0100.05321.12
5.6.180.0230.07021.02
5.6.170.0100.06321.11
5.6.160.0030.09021.14
5.6.150.0070.06721.06
5.6.140.0000.09320.99
5.6.130.0100.08020.94
5.6.120.0130.08320.99
5.6.110.0030.08021.10
5.6.100.0130.05321.00
5.6.90.0230.05020.93
5.6.80.0170.07320.52
5.6.70.0030.06020.49
5.6.60.0070.06720.41
5.6.50.0100.07020.41
5.6.40.0030.05020.25
5.6.30.0070.08320.37
5.6.20.0130.07720.38
5.6.10.0130.07020.40
5.6.00.0100.08020.30
5.5.370.0100.08320.33
5.5.360.0070.08020.34
5.5.350.0070.08320.39
5.5.340.0130.07320.88
5.5.330.0070.08720.91
5.5.320.0070.08320.81
5.5.310.0070.08020.73
5.5.300.0070.07720.86
5.5.290.0000.08720.74
5.5.280.0030.08720.84
5.5.270.0070.05320.91
5.5.260.0100.07720.92
5.5.250.0070.08320.68
5.5.240.0100.06020.32
5.5.230.0070.08020.21
5.5.220.0130.07720.24
5.5.210.0100.08020.18
5.5.200.0230.07020.12
5.5.190.0170.07020.27
5.5.180.0030.08720.11
5.5.160.0030.08320.13
5.5.150.0000.08720.14
5.5.140.0100.08720.08
5.5.130.0000.08320.22
5.5.120.0070.07720.22
5.5.110.0030.05020.26
5.5.100.0030.07720.08
5.5.90.0130.07319.95
5.5.80.0100.06720.05
5.5.70.0030.04319.94
5.5.60.0130.05720.06
5.5.50.0030.06320.04
5.5.40.0070.04720.16
5.5.30.0070.03320.09
5.5.20.0100.06320.05
5.5.10.0070.07720.05
5.5.00.0100.06719.98
5.4.450.0130.07019.43
5.4.440.0070.07719.25
5.4.430.0130.06719.27
5.4.420.0000.08019.22
5.4.410.0100.08019.41
5.4.400.0100.04018.85
5.4.390.0070.07319.04
5.4.380.0100.06718.90
5.4.370.0100.07718.85
5.4.360.0070.08319.13
5.4.350.0000.05019.13
5.4.340.0070.07719.03
5.4.320.0070.07719.04
5.4.310.0070.07719.04
5.4.300.0070.07718.84
5.4.290.0230.06018.84
5.4.280.0100.08019.20
5.4.270.0200.06319.13
5.4.260.0130.06718.94
5.4.250.0070.05719.11
5.4.240.0130.06719.12
5.4.230.0070.06319.09
5.4.220.0100.06719.11
5.4.210.0100.05318.86
5.4.200.0000.08319.08
5.4.190.0030.04019.17
5.4.180.0100.06319.02
5.4.170.0000.04719.15
5.4.160.0070.05319.21
5.4.150.0070.07719.02
5.4.140.0000.07316.43
5.4.130.0170.06716.41
5.4.120.0030.05316.33
5.4.110.0170.04716.53
5.4.100.0070.06716.43
5.4.90.0070.07316.38
5.4.80.0070.06016.32
5.4.70.0170.06716.47
5.4.60.0100.07016.44
5.4.50.0030.07716.25
5.4.40.0000.07016.46
5.4.30.0070.07316.40
5.4.20.0000.06316.44
5.4.10.0030.08016.40
5.4.00.0100.06015.86
5.3.290.0100.07714.64
5.3.280.0100.07314.61
5.3.270.0100.06714.50
5.3.260.0070.08014.59
5.3.250.0130.07014.57
5.3.240.0030.05314.71
5.3.230.0070.07714.61
5.3.220.0130.07714.55
5.3.210.0130.05014.50
5.3.200.0070.07714.61
5.3.190.0070.05314.62
5.3.180.0030.07314.49
5.3.170.0200.07014.59
5.3.160.0030.06714.56
5.3.150.0100.07714.62
5.3.140.0030.08014.62
5.3.130.0030.07714.53
5.3.120.0030.07314.61
5.3.110.0100.06014.56
5.3.100.0100.06714.02
5.3.90.0070.06714.03
5.3.80.0200.06314.12
5.3.70.0100.07313.95
5.3.60.0030.07713.93
5.3.50.0130.06713.88
5.3.40.0000.06714.01
5.3.30.0070.05013.83
5.3.20.0070.06313.72
5.3.10.0030.05013.73
5.3.00.0000.06013.76
5.2.170.0030.04312.46
5.2.160.0100.05012.46
5.2.150.0130.05012.46
5.2.140.0000.05012.46
5.2.130.0030.03712.46
5.2.120.0030.05312.46
5.2.110.0030.06712.46
5.2.100.0130.05012.46
5.2.90.0070.05312.46
5.2.80.0070.06712.46
5.2.70.0000.06312.46
5.2.60.0100.05712.46
5.2.50.0000.05312.46
5.2.40.0070.05012.46
5.2.30.0100.05312.46
5.2.20.0100.05012.46
5.2.10.0070.02712.46
5.2.00.0030.03312.46
5.1.60.0130.05012.46
5.1.50.0070.05012.46
5.1.40.0030.06012.46
5.1.30.0030.05712.46
5.1.20.0130.06012.46
5.1.10.0030.04312.46
5.1.00.0000.03012.46
5.0.50.0070.03312.46
5.0.40.0000.04712.46
5.0.30.0030.05312.46
5.0.20.0070.04012.46
5.0.10.0070.04012.46
5.0.00.0000.05712.46
4.4.90.0000.02712.46
4.4.80.0070.01712.46
4.4.70.0000.04012.46
4.4.60.0000.04012.46
4.4.50.0070.03012.46
4.4.40.0030.05312.46
4.4.30.0000.03012.46
4.4.20.0000.03712.46
4.4.10.0030.03712.46
4.4.00.0030.03312.46
4.3.110.0030.01712.46
4.3.100.0070.03012.46
4.3.90.0000.03312.46
4.3.80.0100.05012.46
4.3.70.0000.03012.46
4.3.60.0000.02712.46
4.3.50.0000.02312.46
4.3.40.0030.02712.46
4.3.30.0000.03712.46
4.3.20.0030.03712.46
4.3.10.0000.03312.46
4.3.00.0000.02712.46

preferences:
44.59 ms | 400 KiB | 5 Q