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' => false, 'province' => 'Ontario', 'degree' => false ); //echo interpolateString($str, $arrContext); echo "\n"; $arrMatches = array(); preg_match_all("/\[(\w+)\=([^\[\]\|.*]*)?\|*([^\[\].*]*)\]/", $str, $arrMatches); $contextKeys = $arrMatches[1]; $contextCondition = array(); $contextValues = array(); $i = 0; foreach ($contextKeys as $key){ $contextCondition += array($key => $arrMatches[0][$i]); $i++;} $i = 0; foreach ($contextKeys as $key){ $value = $arrContext[$key] != false ? 2 : 3; $contextValues += array($key => $arrMatches[$value][$i]); $i++;} foreach ($contextKeys as $key){ echo "{$key} -> {$contextCondition[$key]} -> {$contextValues[$key]}\n"; }

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.75
8.3.50.0100.01022.08
8.3.40.0110.00419.09
8.3.30.0140.00719.17
8.3.20.0070.00020.34
8.3.10.0040.00423.66
8.3.00.0050.00320.69
8.2.180.0110.01116.63
8.2.170.0120.00322.96
8.2.160.0070.00722.25
8.2.150.0080.00024.18
8.2.140.0030.00524.66
8.2.130.0000.00726.16
8.2.120.0080.00022.25
8.2.110.0090.00022.20
8.2.100.0120.00017.97
8.2.90.0050.00319.08
8.2.80.0000.00818.05
8.2.70.0040.00417.75
8.2.60.0030.00618.16
8.2.50.0030.00618.07
8.2.40.0030.00820.01
8.2.30.0040.00418.23
8.2.20.0040.00417.95
8.2.10.0000.00817.92
8.2.00.0000.00817.91
8.1.280.0000.01425.92
8.1.270.0050.00323.88
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0080.00023.91
8.1.230.0030.00919.17
8.1.220.0000.00817.74
8.1.210.0030.00518.77
8.1.200.0090.00017.35
8.1.190.0040.00417.53
8.1.180.0000.00818.10
8.1.170.0060.00318.59
8.1.160.0040.00421.98
8.1.150.0030.00518.72
8.1.140.0030.00617.67
8.1.130.0000.00717.95
8.1.120.0050.00217.57
8.1.110.0000.00717.66
8.1.100.0040.00417.59
8.1.90.0040.00417.51
8.1.80.0030.00317.67
8.1.70.0000.00717.52
8.1.60.0000.00917.68
8.1.50.0000.00917.71
8.1.40.0080.00017.63
8.1.30.0030.00617.72
8.1.20.0000.00817.73
8.1.10.0030.00517.77
8.1.00.0040.00417.69
8.0.300.0000.00718.77
8.0.290.0080.00017.15
8.0.280.0030.00318.52
8.0.270.0040.00417.30
8.0.260.0050.00216.92
8.0.250.0030.00317.18
8.0.240.0070.00017.17
8.0.230.0030.00317.09
8.0.220.0030.00417.11
8.0.210.0070.00017.14
8.0.200.0030.00517.25
8.0.190.0040.00417.25
8.0.180.0040.00417.13
8.0.170.0030.00517.11
8.0.160.0000.00817.07
8.0.150.0080.00017.08
8.0.140.0080.00017.10
8.0.130.0060.00013.59
8.0.120.0080.00017.02
8.0.110.0050.00317.13
8.0.100.0050.00217.17
8.0.90.0040.00416.92
8.0.80.0060.00917.13
8.0.70.0030.00516.90
8.0.60.0000.00717.14
8.0.50.0000.00717.11
8.0.30.0100.01017.18
8.0.20.0090.00917.56
8.0.10.0040.00417.14
8.0.00.0080.01217.06
7.4.330.0050.00015.05
7.4.320.0070.00016.76
7.4.300.0060.00016.78
7.4.290.0020.00616.81
7.4.280.0030.00516.84
7.4.270.0080.00016.75
7.4.260.0050.00216.73
7.4.250.0000.00716.80
7.4.240.0040.00316.68
7.4.230.0070.00016.58
7.4.220.0170.01016.94
7.4.210.0080.01016.77
7.4.200.0000.00816.84
7.4.190.0050.00316.92
7.4.160.0120.00416.77
7.4.150.0110.00617.40
7.4.140.0100.00917.86
7.4.130.0100.01116.87
7.4.120.0130.00716.67
7.4.110.0130.00416.80
7.4.100.0060.01516.65
7.4.90.0140.00316.55
7.4.80.0120.00616.77
7.4.70.0100.00716.58
7.4.60.0100.00716.78
7.4.50.0000.00516.43
7.4.40.0070.01022.77
7.4.30.0160.00016.64
7.4.10.0070.01115.29
7.4.00.0120.00515.26
7.3.330.0050.00013.53
7.3.320.0060.00013.46
7.3.310.0050.00216.56
7.3.300.0050.00216.53
7.3.290.0060.00916.52
7.3.280.0110.00816.52
7.3.270.0090.00917.40
7.3.260.0130.00516.72
7.3.250.0120.00616.62
7.3.240.0230.00016.87
7.3.230.0090.00916.73
7.3.210.0160.00016.62
7.3.200.0150.00619.39
7.3.190.0030.01816.39
7.3.180.0060.01316.58
7.3.170.0100.00616.75
7.3.160.0070.01016.79
7.3.130.0030.01414.98
7.3.120.0080.01015.18
7.3.110.0040.01414.99
7.3.100.0060.00914.86
7.3.90.0040.01214.77
7.3.80.0040.00714.96
7.3.70.0090.00615.02
7.3.60.0100.01015.16
7.3.50.0120.00315.12
7.3.40.0030.01014.91
7.3.30.0060.00314.92
7.3.20.0070.01316.80
7.3.10.0040.01116.75
7.3.00.0040.01016.61
7.2.330.0120.00916.77
7.2.320.0100.00616.86
7.2.310.0080.00816.84
7.2.300.0070.01116.87
7.2.290.0040.01816.90
7.2.260.0030.01515.13
7.2.250.0060.01215.34
7.2.240.0040.01215.28
7.2.230.0110.00415.07
7.2.220.0030.01615.50
7.2.210.0000.01015.26
7.2.200.0090.00615.43
7.2.190.0080.00615.30
7.2.180.0080.01215.23
7.2.170.0080.00314.95
7.2.160.0090.00315.34
7.2.150.0070.01417.37
7.2.140.0070.00717.20
7.2.130.0050.01117.11
7.2.120.0050.01016.99
7.2.110.0090.00316.96
7.2.100.0040.00917.13
7.2.90.0030.01017.10
7.2.80.0050.01216.84
7.2.70.0080.00617.08
7.2.60.0080.00716.95
7.2.50.0060.00816.86
7.2.40.0030.01017.13
7.2.30.0030.01316.95
7.2.20.0060.00916.94
7.2.10.0100.00417.02
7.2.00.0050.00717.89
7.1.330.0040.01116.02
7.1.320.0060.01216.29
7.1.310.0100.00316.11
7.1.300.0100.00616.15
7.1.290.0030.01015.69
7.1.280.0070.00715.76
7.1.270.0080.00815.95
7.1.260.0060.00616.08
7.1.250.0070.00715.71
7.1.240.0030.01016.13
7.1.230.0120.00616.01
7.1.220.0090.00915.80
7.1.210.0040.01216.04
7.1.200.0040.00915.91
7.1.190.0030.01216.20
7.1.180.0070.00416.19
7.1.170.0100.00315.74
7.1.160.0030.01016.20
7.1.150.0060.00916.17
7.1.140.0000.01216.17
7.1.130.0030.01016.09
7.1.120.0070.00716.16
7.1.110.0120.00316.11
7.1.100.0050.00616.98
7.1.90.0070.00715.99
7.1.80.0000.01315.69
7.1.70.0040.00516.83
7.1.60.0050.01017.60
7.1.50.0020.00816.50
7.1.40.0080.00416.07
7.1.30.0040.01116.00
7.1.20.0040.01116.06
7.1.10.0030.01415.87
7.1.00.0030.04519.20
7.0.330.0030.01015.75
7.0.320.0100.00015.78
7.0.310.0030.01015.67
7.0.300.0060.01115.48
7.0.290.0040.01115.61
7.0.280.0030.00615.35
7.0.270.0030.00715.75
7.0.260.0060.00915.75
7.0.250.0110.00015.67
7.0.240.0060.00315.74
7.0.230.0030.01015.65
7.0.220.0000.01215.77
7.0.210.0030.00515.49
7.0.200.0090.00815.48
7.0.190.0080.00315.73
7.0.180.0040.00815.36
7.0.170.0000.01215.63
7.0.160.0100.00315.45
7.0.150.0090.00415.57
7.0.140.0040.04118.71
7.0.130.0050.00515.75
7.0.120.0110.00015.91
7.0.110.0100.00315.47
7.0.100.0100.03717.88
7.0.90.0070.03817.71
7.0.80.0140.03617.86
7.0.70.0050.03317.64
7.0.60.0090.02717.82
7.0.50.0090.04417.74
7.0.40.0050.04516.89
7.0.30.0080.04817.04
7.0.20.0100.04616.81
7.0.10.0060.04416.96
7.0.00.0100.03816.78
5.6.400.0090.00314.25
5.6.390.0030.01014.76
5.6.380.0070.00714.50
5.6.370.0060.00614.80
5.6.360.0110.00714.79
5.6.350.0070.00314.87
5.6.340.0040.00714.25
5.6.330.0100.00314.67
5.6.320.0080.00414.59
5.6.310.0100.00014.67
5.6.300.0090.00314.61
5.6.290.0080.00414.57
5.6.280.0070.03917.80
5.6.270.0090.00914.17
5.6.260.0070.00714.34
5.6.250.0040.03917.64
5.6.240.0020.05217.52
5.6.230.0080.05017.52
5.6.220.0070.03917.65
5.6.210.0080.03117.44
5.6.200.0050.04517.78
5.6.190.0080.03317.64
5.6.180.0070.03917.84
5.6.170.0020.05417.74
5.6.160.0080.04217.82
5.6.150.0020.03917.94
5.6.140.0080.03917.83
5.6.130.0100.03717.74
5.6.120.0060.03917.82
5.6.110.0020.04017.69
5.6.100.0120.03717.85
5.6.90.0030.04817.75
5.6.80.0050.04617.38
5.6.70.0050.04817.42
5.6.60.0050.04117.48
5.6.50.0130.04117.48
5.6.40.0050.02717.50
5.6.30.0090.03517.30
5.6.20.0030.04417.36
5.6.10.0080.04017.43
5.6.00.0100.04117.46
5.5.380.0050.04717.53
5.5.370.0080.04617.49
5.5.360.0070.04717.38
5.5.350.0030.04017.65
5.5.340.0140.03217.48
5.5.330.0060.03917.73
5.5.320.0080.04317.59
5.5.310.0090.03617.81
5.5.300.0040.04417.69
5.5.290.0060.02817.53
5.5.280.0060.04817.60
5.5.270.0080.04317.71
5.5.260.0040.04017.68
5.5.250.0120.04217.57
5.5.240.0050.04217.36
5.5.230.0130.03517.25
5.5.220.0050.04617.38
5.5.210.0050.03717.41
5.5.200.0070.04217.44
5.5.190.0080.04117.41
5.5.180.0080.04017.32
5.5.170.0070.00714.45
5.5.160.0050.04817.33
5.5.150.0120.03417.38
5.5.140.0020.03017.26
5.5.130.0130.04017.45
5.5.120.0100.03317.04
5.5.110.0030.04817.31
5.5.100.0070.03417.17
5.5.90.0070.03517.10
5.5.80.0090.03917.26
5.5.70.0070.04017.18
5.5.60.0050.04217.28
5.5.50.0090.03717.16
5.5.40.0070.04417.14
5.5.30.0070.04517.12
5.5.20.0060.02817.33
5.5.10.0100.03717.26
5.5.00.0070.03517.02
5.4.450.0050.03515.84
5.4.440.0070.03415.86
5.4.430.0080.03815.82
5.4.420.0030.04515.85
5.4.410.0050.04115.82
5.4.400.0050.04115.68
5.4.390.0110.03615.63
5.4.380.0030.02815.66
5.4.370.0050.03315.69
5.4.360.0060.04315.59
5.4.350.0050.03815.64
5.4.340.0080.02015.71
5.4.330.0030.01212.23
5.4.320.0050.03915.67
5.4.310.0030.02815.54
5.4.300.0130.03515.63
5.4.290.0030.04615.63
5.4.280.0080.04415.68
5.4.270.0080.03315.54
5.4.260.0050.03815.59
5.4.250.0050.04215.71
5.4.240.0050.03815.63
5.4.230.0070.03315.72
5.4.220.0130.03215.70
5.4.210.0080.03815.56
5.4.200.0030.04315.67
5.4.190.0040.03715.67
5.4.180.0030.04415.69
5.4.170.0050.03115.70
5.4.160.0020.04515.69
5.4.150.0090.03615.53
5.4.140.0040.03214.30
5.4.130.0130.03014.30
5.4.120.0100.03714.18
5.4.110.0050.04114.34
5.4.100.0050.04014.37
5.4.90.0050.03214.29
5.4.80.0040.04014.34
5.4.70.0100.03614.31
5.4.60.0080.03714.27
5.4.50.0050.04114.34
5.4.40.0040.03914.32
5.4.30.0120.03314.23
5.4.20.0060.03614.31
5.4.10.0050.04014.35
5.4.00.0050.04014.02
5.3.290.0080.03813.45
5.3.280.0070.04013.42
5.3.270.0080.03813.41
5.3.260.0070.04013.45
5.3.250.0100.03513.44
5.3.240.0060.04013.48
5.3.230.0070.03813.40
5.3.220.0050.03713.38
5.3.210.0060.03813.39
5.3.200.0050.04213.37
5.3.190.0060.04213.46
5.3.180.0100.03613.45
5.3.170.0050.04213.43
5.3.160.0030.04013.41
5.3.150.0070.03513.44
5.3.140.0070.03913.43
5.3.130.0070.04113.42
5.3.120.0100.03313.36
5.3.110.0100.03513.46
5.3.100.0070.02713.19
5.3.90.0120.03513.14
5.3.80.0100.03513.08
5.3.70.0030.03513.16
5.3.60.0050.04013.09
5.3.50.0090.03313.15
5.3.40.0000.03413.13
5.3.30.0070.02513.14
5.3.20.0070.03812.96
5.3.10.0060.04012.91
5.3.00.0080.03412.97
5.2.170.0030.03313.17
5.2.160.0030.06313.17
5.2.150.0070.03013.17
5.2.140.0000.07313.17
5.2.130.0070.04713.17
5.2.120.0030.06013.17
5.2.110.0030.06313.17
5.2.100.0030.06313.17
5.2.90.0070.05713.17
5.2.80.0070.05013.17
5.2.70.0000.04313.17
5.2.60.0070.06313.17
5.2.50.0070.05013.17
5.2.40.0000.06713.17
5.2.30.0030.05713.17
5.2.20.0070.06013.17
5.2.10.0100.04013.17
5.2.00.0000.06013.17
5.1.60.0030.04313.17
5.1.50.0070.05013.17
5.1.40.0030.04713.17
5.1.30.0000.06013.17
5.1.20.0070.05013.17
5.1.10.0030.05713.17
5.1.00.0030.05013.17
5.0.50.0030.03713.17
5.0.40.0030.03713.17
5.0.30.0030.06713.17
5.0.20.0030.03013.17
5.0.10.0070.03713.17
5.0.00.0000.05013.17
4.4.90.0030.02313.17
4.4.80.0070.01313.17
4.4.70.0000.04013.17
4.4.60.0000.03313.17
4.4.50.0030.03313.17
4.4.40.0000.04313.17
4.4.30.0000.03713.17
4.4.20.0070.03013.17
4.4.10.0030.03313.17
4.4.00.0030.04713.17
4.3.110.0000.03713.17
4.3.100.0030.03013.17
4.3.90.0000.04013.17
4.3.80.0030.05313.17
4.3.70.0000.02313.17
4.3.60.0000.03313.17
4.3.50.0000.03313.17
4.3.40.0100.04013.17
4.3.30.0070.02313.17
4.3.20.0070.02713.17
4.3.10.0030.03313.17
4.3.00.0000.03713.17

preferences:
38.65 ms | 401 KiB | 5 Q