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]; $i = 0; foreach ($contextKeys as $key){ $contextCondition = array($key => $arrMatches[0][$i]); $i++; } foreach ($contextKeys as $key){ echo "{$key} -> {$contextCondition[$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.70.0100.00717.25
8.3.60.0210.00018.93
8.3.50.0100.01022.18
8.3.40.0140.00718.92
8.3.30.0140.00018.91
8.3.20.0090.00618.82
8.3.10.0140.00421.12
8.3.00.0080.00021.73
8.2.180.0160.00616.63
8.2.170.0150.00322.96
8.2.160.0070.01420.27
8.2.150.0030.00524.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0040.00421.10
8.2.110.0030.00620.29
8.2.100.0060.00617.97
8.2.90.0040.00419.34
8.2.80.0030.00517.97
8.2.70.0070.00318.00
8.2.60.0050.00317.93
8.2.50.0030.00618.07
8.2.40.0050.00318.02
8.2.30.0080.00021.21
8.2.20.0040.00418.02
8.2.10.0080.00018.07
8.2.00.0030.00818.02
8.1.280.0170.00325.92
8.1.270.0050.00323.99
8.1.260.0050.00326.35
8.1.250.0080.00028.09
8.1.240.0030.00720.57
8.1.230.0070.00420.88
8.1.220.0030.00618.77
8.1.210.0080.00019.03
8.1.200.0030.00717.47
8.1.190.0000.00817.40
8.1.180.0000.00918.10
8.1.170.0080.00018.70
8.1.160.0040.00418.84
8.1.150.0110.00018.80
8.1.140.0050.00317.66
8.1.130.0030.00317.91
8.1.120.0000.00817.61
8.1.110.0000.00717.63
8.1.100.0070.00017.64
8.1.90.0000.00717.57
8.1.80.0000.00817.63
8.1.70.0030.00317.54
8.1.60.0130.00017.75
8.1.50.0040.00417.70
8.1.40.0000.00817.73
8.1.30.0050.00317.82
8.1.20.0050.00317.90
8.1.10.0040.00417.71
8.1.00.0040.00417.66
8.0.300.0050.00320.09
8.0.290.0050.00317.30
8.0.280.0000.00718.48
8.0.270.0070.00017.17
8.0.260.0000.00717.02
8.0.250.0000.00717.15
8.0.240.0080.00017.21
8.0.230.0000.00717.05
8.0.220.0000.00717.13
8.0.210.0070.00017.02
8.0.200.0000.00717.19
8.0.190.0000.00717.14
8.0.180.0020.00517.07
8.0.170.0040.00417.12
8.0.160.0040.00417.09
8.0.150.0000.00816.90
8.0.140.0040.00417.11
8.0.130.0030.00313.58
8.0.120.0040.00417.11
8.0.110.0030.00517.07
8.0.100.0040.00417.14
8.0.90.0000.00817.13
8.0.80.0060.00917.04
8.0.70.0000.00817.10
8.0.60.0000.00716.95
8.0.50.0040.00417.18
8.0.30.0090.01017.42
8.0.20.0100.01017.40
8.0.10.0050.00217.09
8.0.00.0130.00616.70
7.4.330.0000.00516.80
7.4.320.0030.00316.69
7.4.300.0030.00316.73
7.4.290.0040.00416.88
7.4.280.0000.01016.74
7.4.270.0000.00716.76
7.4.260.0000.00713.52
7.4.250.0040.00416.80
7.4.240.0030.00316.74
7.4.230.0070.00016.73
7.4.220.0030.02216.80
7.4.210.0090.00616.74
7.4.200.0070.00016.84
7.4.190.0040.00416.98
7.4.160.0130.00316.72
7.4.150.0040.01517.40
7.4.140.0090.00917.86
7.4.130.0070.01016.68
7.4.120.0100.00816.89
7.4.110.0060.01616.77
7.4.100.0060.01216.71
7.4.90.0190.00616.81
7.4.80.0080.01619.39
7.4.70.0100.01016.54
7.4.60.0130.00616.73
7.4.50.0050.00516.73
7.4.40.0060.01122.77
7.4.30.0080.00916.75
7.4.10.0070.01114.97
7.4.00.0070.00915.25
7.3.330.0030.00313.43
7.3.320.0110.00413.44
7.3.310.0050.00316.60
7.3.300.0000.00816.60
7.3.290.0090.01216.60
7.3.280.0090.01116.55
7.3.270.0170.00017.40
7.3.260.0080.01018.24
7.3.250.0140.00516.53
7.3.240.0110.00516.61
7.3.230.0110.00516.83
7.3.210.0110.00616.86
7.3.200.0090.01219.39
7.3.190.0140.00816.59
7.3.180.0130.00316.70
7.3.170.0150.00416.59
7.3.160.0120.00416.89
7.3.130.0060.01215.07
7.3.120.0080.01015.14
7.3.110.0130.00614.84
7.3.100.0090.00314.70
7.3.90.0050.00814.88
7.3.80.0110.00314.64
7.3.70.0000.00914.82
7.3.60.0050.00514.93
7.3.50.0040.00814.86
7.3.40.0060.00314.59
7.3.30.0030.00614.81
7.3.20.0030.01216.65
7.3.10.0040.01116.63
7.3.00.0060.01016.79
7.2.330.0120.00616.84
7.2.320.0120.00416.87
7.2.310.0050.01416.80
7.2.300.0120.00416.83
7.2.290.0030.01316.80
7.2.260.0070.01415.23
7.2.250.0040.01414.95
7.2.240.0140.00314.83
7.2.230.0090.00615.15
7.2.220.0040.00815.18
7.2.210.0120.00014.81
7.2.200.0070.01014.80
7.2.190.0060.00915.28
7.2.180.0050.00514.79
7.2.170.0030.01015.10
7.2.160.0000.01615.38
7.2.150.0100.00716.73
7.2.140.0040.00816.72
7.2.130.0000.01416.71
7.2.120.0070.01016.85
7.2.110.0110.00316.69
7.2.100.0000.01316.96
7.2.90.0100.00717.23
7.2.80.0100.00316.71
7.2.70.0080.00416.80
7.2.60.0080.00817.07
7.2.50.0030.01317.29
7.2.40.0100.00316.88
7.2.30.0030.01016.99
7.2.20.0040.01517.07
7.2.10.0040.01517.11
7.2.00.0050.00918.19
7.1.330.0100.00315.93
7.1.320.0030.01015.93
7.1.310.0040.01115.60
7.1.300.0060.00915.46
7.1.290.0070.00415.92
7.1.280.0100.00315.81
7.1.270.0040.00816.04
7.1.260.0080.00415.94
7.1.250.0030.00615.77
7.1.240.0030.00715.91
7.1.230.0080.00515.94
7.1.220.0070.00715.75
7.1.210.0030.00915.88
7.1.200.0040.00715.95
7.1.190.0090.00415.84
7.1.180.0040.01215.56
7.1.170.0040.01115.80
7.1.160.0090.00316.02
7.1.150.0150.00016.05
7.1.140.0000.01815.93
7.1.130.0140.00316.01
7.1.120.0060.00915.98
7.1.110.0090.00315.69
7.1.100.0040.00917.16
7.1.90.0070.00715.63
7.1.80.0090.00015.65
7.1.70.0010.01216.47
7.1.60.0070.01017.61
7.1.50.0050.01516.59
7.1.40.0030.01015.78
7.1.30.0120.00315.83
7.1.20.0100.00315.79
7.1.10.0040.00715.88
7.1.00.0020.03519.09
7.0.330.0000.01315.00
7.0.320.0030.00715.36
7.0.310.0080.00015.31
7.0.300.0030.01215.09
7.0.290.0050.00515.28
7.0.280.0100.00715.48
7.0.270.0100.00315.41
7.0.260.0100.00615.45
7.0.250.0060.00615.28
7.0.240.0080.00415.40
7.0.230.0040.00815.39
7.0.220.0040.00715.43
7.0.210.0080.00315.34
7.0.200.0070.00816.27
7.0.190.0040.00415.24
7.0.180.0050.00515.36
7.0.170.0000.01215.57
7.0.160.0070.00615.47
7.0.150.0030.01015.14
7.0.140.0000.04618.56
7.0.130.0000.01415.38
7.0.120.0040.01115.50
7.0.110.0090.00315.46
7.0.100.0030.01015.37
7.0.90.0030.01015.42
7.0.80.0070.00715.35
7.0.70.0460.04517.50
7.0.60.0460.04317.61
7.0.50.0270.04317.86
7.0.40.0090.03916.61
7.0.30.0080.04516.82
7.0.20.0120.04016.87
7.0.10.0020.03216.88
7.0.00.0070.04216.81
5.6.400.0030.00714.28
5.6.390.0030.01314.00
5.6.380.0100.00014.14
5.6.370.0100.00313.96
5.6.360.0000.01014.15
5.6.350.0040.01114.67
5.6.340.0030.00913.98
5.6.330.0030.01014.53
5.6.320.0070.00714.34
5.6.310.0130.00314.31
5.6.300.0030.00714.49
5.6.290.0090.00614.46
5.6.280.0050.02817.77
5.6.270.0000.01414.54
5.6.260.0100.00314.18
5.6.250.0120.00414.32
5.6.240.0000.01414.49
5.6.230.0040.00714.33
5.6.220.0100.04517.47
5.6.210.0080.04317.43
5.6.200.0070.02317.69
5.6.190.0030.03017.76
5.6.180.0070.03717.49
5.6.170.0050.04517.71
5.6.160.0050.02817.72
5.6.150.0030.04617.59
5.6.140.0080.04317.59
5.6.130.0100.03817.68
5.6.120.0120.03417.56
5.6.110.0070.04517.73
5.6.100.0080.03717.65
5.6.90.0150.04017.74
5.6.80.0080.02617.29
5.6.70.0050.03417.36
5.6.60.0070.04217.40
5.6.50.0030.05017.31
5.6.40.0100.04017.38
5.6.30.0060.04317.29
5.6.20.0070.04717.23
5.6.10.0110.03617.26
5.6.00.0080.04417.24
5.5.380.0040.01214.56
5.5.370.0030.00914.57
5.5.360.0130.04317.16
5.5.350.0080.04517.59
5.5.340.0070.03017.36
5.5.330.0020.04117.55
5.5.320.0050.04817.56
5.5.310.0050.03317.47
5.5.300.0030.03017.45
5.5.290.0120.04517.48
5.5.280.0130.04317.47
5.5.270.0110.04217.55
5.5.260.0080.03017.62
5.5.250.0040.05017.34
5.5.240.0060.04117.20
5.5.230.0030.03517.19
5.5.220.0060.04017.16
5.5.210.0050.04817.27
5.5.200.0100.03717.29
5.5.190.0070.04217.18
5.5.180.0150.04017.32
5.5.170.0120.00314.22
5.5.160.0140.04117.08
5.5.150.0080.04016.99
5.5.140.0080.02817.16
5.5.130.0030.04717.24
5.5.120.0030.02717.14
5.5.110.0080.02817.37
5.5.100.0030.04517.20
5.5.90.0080.02217.27
5.5.80.0080.03517.09
5.5.70.0070.04217.23
5.5.60.0080.04117.32
5.5.50.0000.03117.16
5.5.40.0030.04817.26
5.5.30.0080.02017.11
5.5.20.0070.03517.31
5.5.10.0070.02317.12
5.5.00.0070.02217.04
5.4.450.0050.04515.24
5.4.440.0080.04015.52
5.4.430.0020.04015.16
5.4.420.0050.03215.44
5.4.410.0080.04215.29
5.4.400.0080.04015.06
5.4.390.0110.03415.14
5.4.380.0040.03815.11
5.4.370.0120.02014.99
5.4.360.0030.04415.23
5.4.350.0120.03615.10
5.4.340.0030.04515.32
5.4.330.0060.00011.18
5.4.320.0100.03514.86
5.4.310.0110.03615.16
5.4.300.0020.02814.99
5.4.290.0090.02315.10
5.4.280.0040.02415.07
5.4.270.0090.03715.19
5.4.260.0020.04215.11
5.4.250.0020.03615.00
5.4.240.0050.03715.31
5.4.230.0050.04315.04
5.4.220.0000.05015.08
5.4.210.0030.04314.97
5.4.200.0090.03314.81
5.4.190.0030.02315.15
5.4.180.0070.02715.02
5.4.170.0050.03015.15
5.4.160.0020.02715.11
5.4.150.0030.02315.05
5.4.140.0060.02013.82
5.4.130.0030.02113.65
5.4.120.0050.02013.74
5.4.110.0030.03013.59
5.4.100.0060.02013.70
5.4.90.0050.02013.86
5.4.80.0050.02213.54
5.4.70.0030.02713.76
5.4.60.0040.02013.59
5.4.50.0020.03413.75
5.4.40.0030.02013.70
5.4.30.0080.02513.95
5.4.20.0030.04213.72
5.4.10.0040.03913.60
5.4.00.0040.02413.54
5.3.290.0060.04112.71
5.3.280.0080.04012.52
5.3.270.0070.03012.67
5.3.260.0050.01812.68
5.3.250.0010.02112.49
5.3.240.0060.04312.56
5.3.230.0030.02312.65
5.3.220.0050.02212.46
5.3.210.0020.04212.68
5.3.200.0050.02212.64
5.3.190.0010.02312.44
5.3.180.0030.02112.67
5.3.170.0010.02312.72
5.3.160.0040.02112.77
5.3.150.0030.02012.74
5.3.140.0060.02812.62
5.3.130.0050.02312.71
5.3.120.0030.02212.63
5.3.110.0070.02012.62
5.3.100.0000.02412.26
5.3.90.0060.03412.43
5.3.80.0020.02712.27
5.3.70.0020.02412.33
5.3.60.0060.02012.42
5.3.50.0030.02212.36
5.3.40.0020.03612.25
5.3.30.0050.02012.20
5.3.20.0050.01712.04
5.3.10.0020.01712.04
5.3.00.0030.02412.10
5.2.170.0030.02711.14
5.2.160.0000.03011.18
5.2.150.0000.03011.16
5.2.140.0070.02711.13
5.2.130.0070.06011.13
5.2.120.0030.02311.03
5.2.110.0030.03011.19
5.2.100.0000.02711.17
5.2.90.0030.02710.99
5.2.80.0000.03711.23
5.2.70.0030.02311.17
5.2.60.0030.02711.06
5.2.50.0000.02711.01
5.2.40.0030.02710.87
5.2.30.0030.03010.93
5.2.20.0030.04711.03
5.2.10.0030.02310.86
5.2.00.0000.06010.66
5.1.60.0000.02010.66
5.1.50.0070.03310.66
5.1.40.0070.02010.66
5.1.30.0000.02710.66
5.1.20.0000.02310.66
5.1.10.0070.02710.66
5.1.00.0030.05310.66
5.0.50.0100.04310.66
5.0.40.0000.04710.66
5.0.30.0100.06010.66
5.0.20.0070.04010.66
5.0.10.0000.04010.66
5.0.00.0030.05310.66
4.4.90.0000.01710.66
4.4.80.0000.01710.66
4.4.70.0030.01710.66
4.4.60.0000.01310.66
4.4.50.0000.02310.66
4.4.40.0030.02010.66
4.4.30.0000.01710.66
4.4.20.0000.01710.66
4.4.10.0000.02710.66
4.4.00.0070.05710.66
4.3.110.0000.03710.66
4.3.100.0000.03710.66
4.3.90.0000.02310.66
4.3.80.0030.05010.66
4.3.70.0000.02310.66
4.3.60.0000.03710.66
4.3.50.0070.02710.66
4.3.40.0030.04310.66
4.3.30.0030.02710.66
4.3.20.0000.04010.66
4.3.10.0030.02710.66
4.3.00.0000.03710.66

preferences:
46.59 ms | 401 KiB | 5 Q