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.60.0140.00718.81
8.3.50.0160.00222.02
8.3.40.0090.00919.21
8.3.30.0090.00619.18
8.3.20.0000.00720.16
8.3.10.0030.00521.92
8.3.00.0080.00022.40
8.2.180.0110.00416.50
8.2.170.0140.00722.96
8.2.160.0110.00421.19
8.2.150.0000.00824.18
8.2.140.0030.00524.66
8.2.130.0040.00426.16
8.2.120.0080.00017.88
8.2.110.0040.00722.24
8.2.100.0060.00619.89
8.2.90.0000.00819.29
8.2.80.0050.00319.79
8.2.70.0070.00317.88
8.2.60.0040.00418.05
8.2.50.0000.00918.07
8.2.40.0030.00518.34
8.2.30.0030.00618.25
8.2.20.0060.00318.07
8.2.10.0080.00019.73
8.2.00.0080.00017.94
8.1.280.0120.00625.92
8.1.270.0000.00823.79
8.1.260.0070.00026.35
8.1.250.0070.00328.09
8.1.240.0060.00323.86
8.1.230.0090.00319.16
8.1.220.0040.00417.78
8.1.210.0050.00318.77
8.1.200.0030.00617.48
8.1.190.0040.00417.53
8.1.180.0040.00418.10
8.1.170.0030.00518.71
8.1.160.0000.00721.94
8.1.150.0000.00918.86
8.1.140.0030.00517.55
8.1.130.0040.00417.93
8.1.120.0070.00017.56
8.1.110.0060.00317.58
8.1.100.0000.00717.64
8.1.90.0040.00417.67
8.1.80.0000.00717.64
8.1.70.0050.00317.59
8.1.60.0030.00617.72
8.1.50.0040.00417.66
8.1.40.0000.00717.65
8.1.30.0030.00617.70
8.1.20.0000.00817.79
8.1.10.0080.00017.71
8.1.00.0040.00417.65
8.0.300.0000.00718.77
8.0.290.0080.00017.30
8.0.280.0000.00818.42
8.0.270.0030.00317.29
8.0.260.0080.00017.06
8.0.250.0030.00317.07
8.0.240.0040.00417.21
8.0.230.0040.00417.21
8.0.220.0030.00317.20
8.0.210.0030.00317.01
8.0.200.0000.00717.23
8.0.190.0040.00417.23
8.0.180.0000.00717.04
8.0.170.0040.00417.19
8.0.160.0000.00817.00
8.0.150.0040.00417.00
8.0.140.0040.00417.02
8.0.130.0000.00613.51
8.0.120.0060.00317.11
8.0.110.0040.00417.02
8.0.100.0030.00517.08
8.0.90.0000.00817.02
8.0.80.0030.01317.18
8.0.70.0050.00317.12
8.0.60.0000.00717.01
8.0.50.0080.00017.00
8.0.30.0070.01217.46
8.0.20.0080.01117.42
8.0.10.0070.00017.33
8.0.00.0080.01216.98
7.4.330.0000.00715.11
7.4.320.0030.00316.60
7.4.300.0030.00316.73
7.4.290.0000.00816.75
7.4.280.0030.00316.75
7.4.270.0040.00416.89
7.4.260.0000.00716.86
7.4.250.0000.00716.71
7.4.240.0020.00516.72
7.4.230.0000.00716.74
7.4.220.0130.01316.76
7.4.210.0080.01016.80
7.4.200.0050.00316.93
7.4.190.0050.00316.85
7.4.160.0080.00816.76
7.4.150.0100.00717.40
7.4.140.0130.00517.86
7.4.130.0100.00716.63
7.4.120.0070.01216.88
7.4.110.0040.01316.60
7.4.100.0100.00716.79
7.4.90.0090.00816.75
7.4.80.0090.00916.82
7.4.70.0120.00816.98
7.4.60.0000.01516.75
7.4.50.0040.00016.70
7.4.40.0070.01022.77
7.4.30.0160.00016.60
7.4.10.0060.01316.57
7.4.00.0080.00815.93
7.3.330.0000.00613.38
7.3.320.0000.00513.48
7.3.310.0070.00016.64
7.3.300.0070.00016.49
7.3.290.0050.00816.61
7.3.280.0060.01116.57
7.3.270.0100.01617.40
7.3.260.0080.01116.84
7.3.250.0050.01216.68
7.3.240.0100.01016.65
7.3.230.0100.00716.61
7.3.210.0140.00716.70
7.3.200.0150.00619.39
7.3.190.0060.01116.91
7.3.180.0070.01516.79
7.3.170.0000.01616.63
7.3.160.0030.01216.53
7.3.130.0130.00616.63
7.3.120.0080.00815.87
7.3.110.0070.00716.75
7.3.100.0060.01216.45
7.3.90.0030.01416.61
7.3.80.0130.00016.53
7.3.70.0110.00416.59
7.3.60.0070.01016.50
7.3.50.0100.01016.55
7.3.40.0000.01416.56
7.3.30.0030.01016.63
7.3.20.0040.01418.38
7.3.10.0030.01518.17
7.3.00.0080.00318.34
7.2.330.0090.01217.05
7.2.320.0090.00916.72
7.2.310.0100.00716.84
7.2.300.0200.00316.66
7.2.290.0110.00516.86
7.2.260.0040.01516.89
7.2.250.0100.01016.90
7.2.240.0090.00916.77
7.2.230.0030.01416.81
7.2.220.0030.01016.84
7.2.210.0050.00516.64
7.2.200.0100.01016.70
7.2.190.0090.00916.70
7.2.180.0090.00616.83
7.2.170.0080.00416.60
7.2.160.0100.00716.79
7.2.150.0070.01318.48
7.2.140.0150.00318.43
7.2.130.0060.00918.57
7.2.120.0070.00418.70
7.2.110.0110.00418.61
7.2.100.0060.00618.77
7.2.90.0000.01518.46
7.2.80.0100.00318.68
7.2.70.0130.00318.43
7.2.60.0070.00517.80
7.2.50.0000.01118.59
7.2.40.0040.00818.64
7.2.30.0040.01418.60
7.2.20.0090.00618.61
7.2.10.0090.00318.52
7.2.00.0080.00719.02
7.1.330.0060.00917.39
7.1.320.0030.01017.59
7.1.310.0060.00817.46
7.1.300.0070.01017.54
7.1.290.0060.00317.65
7.1.280.0000.01217.45
7.1.270.0060.01017.72
7.1.260.0000.01717.46
7.1.250.0040.01117.34
7.1.240.0000.01417.57
7.1.230.0000.01717.59
7.1.220.0080.00817.51
7.1.210.0060.00317.42
7.1.200.0040.00916.71
7.1.190.0090.00517.40
7.1.180.0070.00717.41
7.1.170.0070.00717.55
7.1.160.0040.00717.34
7.1.150.0130.00317.55
7.1.140.0030.00717.65
7.1.130.0080.00417.47
7.1.120.0100.00317.64
7.1.110.0000.01017.39
7.1.100.0070.00617.78
7.1.90.0070.00417.49
7.1.80.0120.00017.73
7.1.70.0000.00817.49
7.1.60.0080.01118.71
7.1.50.0080.01117.40
7.1.40.0100.00717.53
7.1.30.0030.00717.61
7.1.20.0090.00617.49
7.1.10.0040.01117.53
7.1.00.0080.04019.90
7.0.330.0000.01117.07
7.0.320.0000.01417.18
7.0.310.0040.01117.08
7.0.300.0030.01217.30
7.0.290.0030.00617.06
7.0.280.0030.01217.20
7.0.270.0030.00917.10
7.0.260.0000.00917.11
7.0.250.0100.00717.24
7.0.240.0000.01017.08
7.0.230.0080.00817.21
7.0.220.0130.00317.14
7.0.210.0030.00917.24
7.0.200.0020.01117.12
7.0.190.0130.00017.31
7.0.180.0060.00617.44
7.0.170.0120.00017.30
7.0.160.0040.01117.02
7.0.150.0030.01217.06
7.0.140.0040.03919.69
7.0.130.0070.00417.06
7.0.120.0000.01016.98
7.0.110.0030.01017.01
7.0.100.0050.00517.09
7.0.90.0030.01017.12
7.0.80.0080.00317.17
7.0.70.0070.04419.39
7.0.60.0050.04019.43
7.0.50.0120.04219.59
7.0.40.0030.04817.71
7.0.30.0050.02717.67
7.0.20.0100.02717.67
7.0.10.0050.02817.66
7.0.00.0050.02317.64
5.6.400.0060.00916.12
5.6.390.0030.01415.84
5.6.380.0070.01116.21
5.6.370.0000.01416.18
5.6.360.0090.00615.94
5.6.350.0030.01115.90
5.6.340.0120.00316.41
5.6.330.0060.01016.11
5.6.320.0160.00016.12
5.6.310.0070.01315.73
5.6.300.0080.00815.94
5.6.290.0040.01116.25
5.6.280.0050.04018.63
5.6.270.0000.01416.23
5.6.260.0060.00915.80
5.6.250.0070.00716.00
5.6.240.0030.01216.29
5.6.230.0080.00916.15
5.6.220.0050.04718.30
5.6.210.0070.04118.23
5.6.200.0030.03218.48
5.6.190.0050.02918.69
5.6.180.0030.02918.45
5.6.170.0030.05018.42
5.6.160.0100.04118.51
5.6.150.0060.04618.49
5.6.140.0050.04818.51
5.6.130.0090.04418.49
5.6.120.0030.02918.67
5.6.110.0030.03318.53
5.6.100.0060.03018.41
5.6.90.0030.02518.64
5.6.80.0030.02418.16
5.6.70.0020.02618.14
5.6.60.0050.02518.13
5.6.50.0040.02518.22
5.6.40.0000.02818.29
5.6.30.0060.02318.18
5.6.20.0060.02218.11
5.6.10.0050.02218.13
5.6.00.0020.02818.08
5.5.380.0030.01016.07
5.5.370.0070.01316.01
5.5.360.0070.04418.09
5.5.350.0100.04018.23
5.5.340.0070.04218.57
5.5.330.0040.03418.24
5.5.320.0050.02518.37
5.5.310.0060.03118.58
5.5.300.0090.04318.37
5.5.290.0060.04518.42
5.5.280.0070.04418.40
5.5.270.0100.02518.31
5.5.260.0040.04018.39
5.5.250.0030.02718.26
5.5.240.0070.02318.15
5.5.230.0040.02418.02
5.5.220.0020.02718.06
5.5.210.0050.02518.10
5.5.200.0050.02318.02
5.5.190.0070.02318.02
5.5.180.0020.02717.99
5.5.170.0060.01015.99
5.5.160.0060.02018.03
5.5.150.0060.01918.05
5.5.140.0020.02818.11
5.5.130.0050.02118.01
5.5.120.0040.02918.10
5.5.110.0090.02217.99
5.5.100.0050.02717.84
5.5.90.0050.02517.90
5.5.80.0030.02618.00
5.5.70.0090.02218.04
5.5.60.0080.02318.05
5.5.50.0030.02718.04
5.5.40.0110.01817.99
5.5.30.0040.03217.87
5.5.20.0070.02218.08
5.5.10.0000.02917.91
5.5.00.0020.03317.86
5.4.450.0060.04516.06
5.4.440.0050.03115.93
5.4.430.0030.04216.05
5.4.420.0040.02515.96
5.4.410.0070.03515.96
5.4.400.0080.03715.88
5.4.390.0090.01815.90
5.4.380.0050.02415.95
5.4.370.0070.01715.89
5.4.360.0030.02015.92
5.4.350.0030.02115.93
5.4.340.0040.02416.00
5.4.330.0030.00812.69
5.4.320.0080.02715.98
5.4.310.0030.02515.92
5.4.300.0040.02215.96
5.4.290.0100.03716.04
5.4.280.0030.02215.94
5.4.270.0020.03015.95
5.4.260.0060.02016.01
5.4.250.0060.01815.93
5.4.240.0050.02015.86
5.4.230.0090.01715.82
5.4.220.0000.02715.79
5.4.210.0030.02215.93
5.4.200.0020.04515.91
5.4.190.0030.02515.78
5.4.180.0060.02015.95
5.4.170.0090.01715.93
5.4.160.0050.01915.91
5.4.150.0030.02115.77
5.4.140.0020.02314.71
5.4.130.0030.02014.65
5.4.120.0040.02214.60
5.4.110.0020.02214.60
5.4.100.0020.04314.65
5.4.90.0030.02214.59
5.4.80.0030.01814.61
5.4.70.0040.02214.60
5.4.60.0000.02514.53
5.4.50.0030.02014.55
5.4.40.0050.02014.60
5.4.30.0020.02314.61
5.4.20.0060.01714.64
5.4.10.0020.02314.61
5.4.00.0040.02014.38
5.3.290.0050.04314.02
5.3.280.0020.02413.89
5.3.270.0030.02313.79
5.3.260.0050.01813.90
5.3.250.0040.03513.92
5.3.240.0040.02013.77
5.3.230.0020.02413.82
5.3.220.0030.02213.82
5.3.210.0020.02613.89
5.3.200.0030.02313.83
5.3.190.0020.02413.90
5.3.180.0020.03114.06
5.3.170.0030.02313.86
5.3.160.0030.02113.98
5.3.150.0010.02113.93
5.3.140.0000.02514.05
5.3.130.0020.02113.89
5.3.120.0030.02214.03
5.3.110.0020.02214.03
5.3.100.0020.02013.64
5.3.90.0040.02713.64
5.3.80.0040.03113.54
5.3.70.0040.04413.55
5.3.60.0000.03713.61
5.3.50.0030.04213.60
5.3.40.0040.04213.50
5.3.30.0030.01813.50
5.3.20.0070.03713.36
5.3.10.0030.03613.29
5.3.00.0020.04513.27
5.2.170.0070.05012.31
5.2.160.0030.06312.31
5.2.150.0030.02712.31
5.2.140.0000.05712.31
5.2.130.0030.06012.31
5.2.120.0000.05712.31
5.2.110.0030.06312.31
5.2.100.0070.06312.31
5.2.90.0070.04312.31
5.2.80.0000.04012.31
5.2.70.0070.06312.31
5.2.60.0070.04712.31
5.2.50.0030.05012.31
5.2.40.0030.06012.31
5.2.30.0070.06012.31
5.2.20.0030.03712.31
5.2.10.0000.07012.31
5.2.00.0070.05312.31
5.1.60.0030.04312.31
5.1.50.0000.04312.31
5.1.40.0000.05712.31
5.1.30.0100.05312.31
5.1.20.0130.05312.31
5.1.10.0130.02312.31
5.1.00.0000.05712.31
5.0.50.0000.02712.31
5.0.40.0000.04312.31
5.0.30.0100.05312.31
5.0.20.0030.02712.31
5.0.10.0000.03712.31
5.0.00.0030.04312.31
4.4.90.0070.03312.31
4.4.80.0000.03712.31
4.4.70.0030.03712.31
4.4.60.0030.03012.31
4.4.50.0030.02312.31
4.4.40.0000.05712.31
4.4.30.0000.02312.31
4.4.20.0070.02312.31
4.4.10.0000.03012.31
4.4.00.0000.05712.31
4.3.110.0070.02712.31
4.3.100.0000.02312.31
4.3.90.0030.01312.31
4.3.80.0070.03712.31
4.3.70.0030.01712.31
4.3.60.0030.03312.31
4.3.50.0030.01712.31
4.3.40.0030.05012.31
4.3.30.0000.03012.31
4.3.20.0000.03012.31
4.3.10.0000.04012.31
4.3.00.0000.02712.31

preferences:
46.96 ms | 401 KiB | 5 Q