3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr_postcode_regexes = array( 'uk' => array( // Should match any *valid* UK postcode array('[A-Z]', '[A-Z]?', '[0-9]', '[0-9A-Z]?'), ), 'offshore' => array( // All postcode areas that DPD define as "offshore" array('A', 'B', '3', '[0-8]'), // AB30-38 array('A', 'B', '4', '[1-9]'), // AB41-49 array('A', 'B', '5', '[0-6]'), // AB50-56 array('F', 'K', '1', '[789]'), // FK17-19 array('F', 'K', '2', '[01]'), // FK20-21 array('G', '8', '3'), // G83 array('G', 'Y', '9'), // GY9 array('H', 'S', '[1-9]'), // HS1-9 array('I', 'M', '[0-9]', '[0-9A-Z]?'), // IM array('I', 'M', '[0-9]', '[0-9A-Z]?'), // IV array('K', 'A', '2', '[89]'), // KA27-28 array('K', 'W', '[0-9]', '[0-9]?'), // KW0-99 array('P', 'A', '[2-9]', '[0-9]'), // PA20-99 array('P', 'H', '1', '[5-9]'), // PH15-19 array('P', 'H', '[2-9]', '[0-9]'), // PH20-99 array('T', 'R', '2', '[1-5]'), // TR21-25 array('Z', 'E', '[0-9]', '[0-9A-Z]?'), // ZE ), 'ni' => array( // Northern Ireland array('B', 'T', '[0-9]', '[0-9A-Z]?'), // ZE ), ); // Turn the readable-ish map above into actual regexes // It's important that all regexes match only full, valid postcodes, as prefix matching can be ambiguous. // Pack everything out with \s* because people are idiots and put whitespace in weird places. foreach ($arr_postcode_regexes as $str_id => $arr_parts) { $arr_temp = array(); foreach ($arr_parts as $arr_part) { $arr_temp[] = implode('\s*', $arr_part) . '\s*[0-9]\s*[A-Z]\s*[A-Z]'; } $arr_postcode_regexes[$str_id] = '^\s*(' . implode('|', $arr_temp) . ')\s*$'; } var_dump($arr_postcode_regexes);

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.0070.00716.75
8.3.50.0130.00823.06
8.3.40.0070.00718.98
8.3.30.0070.00719.12
8.3.20.0040.00420.20
8.3.10.0080.00023.53
8.3.00.0040.00419.26
8.2.180.0030.01316.50
8.2.170.0170.00322.96
8.2.160.0130.00620.21
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0150.00426.16
8.2.120.0000.00820.85
8.2.110.0060.00322.25
8.2.100.0090.00317.68
8.2.90.0050.00319.25
8.2.80.0030.00517.97
8.2.70.0030.00617.59
8.2.60.0000.00718.04
8.2.50.0030.00618.07
8.2.40.0000.00818.09
8.2.30.0040.00418.07
8.2.20.0040.00417.75
8.2.10.0000.00918.13
8.2.00.0040.00417.80
8.1.280.0110.01125.92
8.1.270.0000.00824.01
8.1.260.0080.00026.35
8.1.250.0030.00528.09
8.1.240.0090.00023.83
8.1.230.0030.00719.16
8.1.220.0030.00617.74
8.1.210.0030.00618.77
8.1.200.0060.00317.00
8.1.190.0000.00817.35
8.1.180.0040.00418.10
8.1.170.0130.00018.07
8.1.160.0080.00022.01
8.1.150.0040.00418.89
8.1.140.0000.00717.46
8.1.130.0070.00017.82
8.1.120.0030.00317.48
8.1.110.0050.00317.47
8.1.100.0000.00717.36
8.1.90.0050.00317.48
8.1.80.0070.00017.49
8.1.70.0070.00017.34
8.1.60.0000.00917.61
8.1.50.0030.00517.44
8.1.40.0040.00417.55
8.1.30.0060.00317.52
8.1.20.0050.00217.66
8.1.10.0030.00617.53
8.1.00.0070.00017.37
8.0.300.0080.00018.77
8.0.290.0040.00416.75
8.0.280.0000.00718.50
8.0.270.0040.00217.26
8.0.260.0030.00317.17
8.0.250.0000.00816.92
8.0.240.0030.00316.92
8.0.230.0030.00616.84
8.0.220.0000.00716.88
8.0.210.0000.00716.79
8.0.200.0040.00316.88
8.0.190.0000.00716.85
8.0.180.0040.00416.91
8.0.170.0080.00016.80
8.0.160.0040.00416.89
8.0.150.0080.00016.86
8.0.140.0090.00016.74
8.0.130.0040.00413.35
8.0.120.0080.00016.89
8.0.110.0040.00416.91
8.0.100.0040.00416.76
8.0.90.0030.00316.77
8.0.80.0090.01316.94
8.0.70.0030.00516.84
8.0.60.0080.00016.93
8.0.50.0000.00816.68
8.0.30.0050.01616.95
8.0.20.0140.00517.40
8.0.10.0000.00816.84
8.0.00.0130.01016.69
7.4.330.0060.00015.00
7.4.320.0030.00316.50
7.4.300.0030.00316.52
7.4.290.0080.00016.63
7.4.280.0040.00416.50
7.4.270.0040.00316.60
7.4.260.0060.00316.52
7.4.250.0000.00816.41
7.4.240.0040.00316.48
7.4.230.0000.00716.36
7.4.220.0160.00616.50
7.4.210.0080.00616.69
7.4.200.0030.00316.41
7.4.160.0060.01016.49
7.4.150.0030.01717.40
7.4.140.0110.00817.86
7.4.130.0070.01016.44
7.4.120.0090.00816.50
7.4.110.0040.01216.64
7.4.100.0060.01416.56
7.4.90.0130.01016.55
7.4.80.0070.01119.39
7.4.70.0030.01316.68
7.4.60.0090.00916.65
7.4.50.0030.00616.54
7.4.40.0100.00716.61
7.4.30.0030.01316.51
7.4.00.0080.00814.95
7.3.330.0060.00013.24
7.3.320.0060.00013.13
7.3.310.0000.00716.50
7.3.300.0030.00316.23
7.3.290.0030.01016.34
7.3.280.0080.00916.31
7.3.270.0040.01317.40
7.3.260.0110.00716.58
7.3.250.0130.00716.54
7.3.240.0060.01216.53
7.3.230.0030.01516.49
7.3.210.0060.01116.33
7.3.200.0160.00619.39
7.3.190.0130.00416.50
7.3.180.0070.00716.42
7.3.170.0130.00316.49
7.3.160.0090.00716.29
7.3.120.0070.01014.50
7.3.110.0090.00614.93
7.3.100.0120.00014.96
7.3.90.0100.00614.73
7.3.80.0040.00414.72
7.3.70.0000.01614.72
7.3.60.0100.00314.73
7.3.50.0090.00314.79
7.3.40.0100.00314.73
7.3.30.0120.00014.71
7.3.20.0030.01116.55
7.3.10.0070.00716.75
7.3.00.0070.00716.70
7.2.330.0090.00916.60
7.2.320.0090.01016.65
7.2.310.0150.00716.59
7.2.300.0070.01316.71
7.2.290.0050.01216.63
7.2.250.0030.01715.23
7.2.240.0100.01015.00
7.2.230.0030.01314.99
7.2.220.0070.01115.04
7.2.210.0060.01015.18
7.2.200.0060.00615.12
7.2.190.0040.01114.72
7.2.180.0060.00315.02
7.2.170.0030.01315.02
7.2.00.0030.00919.42
7.1.330.0030.01015.74
7.1.320.0030.00615.60
7.1.310.0070.01115.71
7.1.300.0000.01015.50
7.1.290.0080.00415.53
7.1.280.0070.00715.55
7.1.270.0070.00715.77
7.1.260.0040.00715.67
7.1.100.0000.01318.27
7.1.70.0000.00717.25
7.1.60.0130.01319.40
7.1.50.0110.01416.84
7.1.00.0030.07722.36
7.0.200.0060.00616.68
7.0.140.0030.07322.21
7.0.60.0100.08320.04
7.0.50.0030.07017.67
7.0.40.0130.08020.20
7.0.30.0200.04720.18
7.0.20.0230.05320.17
7.0.10.0030.06320.13
7.0.00.0070.04320.32
5.6.280.0170.06020.93
5.6.210.0170.04020.78
5.6.200.0070.08318.12
5.6.190.0000.07320.35
5.6.180.3670.04320.77
5.6.170.0270.05020.48
5.6.160.0070.04320.41
5.6.150.0170.03018.20
5.6.140.0100.05318.11
5.6.130.0200.07018.11
5.6.120.0000.05321.00
5.6.110.0170.07721.10
5.6.100.0070.07020.98
5.6.90.0030.09020.98
5.6.80.0130.07320.38
5.6.70.3300.03020.54
5.5.350.0230.06720.43
5.5.340.0100.03317.92
5.5.330.0070.08020.43
5.5.320.3470.04720.13
5.5.310.0230.04720.32
5.5.300.0100.03718.02
5.5.290.0100.08017.91
5.5.280.0030.05020.86
5.5.270.0000.04320.88
5.5.260.0100.08720.96
5.5.250.0100.08320.71
5.5.240.0170.07720.08
5.4.450.0530.03719.43
5.4.440.0470.04319.46
5.4.430.0700.04319.25
5.4.420.0370.04719.23
5.4.410.0370.04019.13
5.4.400.0370.03718.92
5.4.390.0700.04019.16
5.4.380.0570.06018.56
5.4.370.1070.05718.56
5.4.360.1100.04718.71
5.4.350.1030.05018.70
5.4.340.1070.05318.66
5.4.320.0050.03712.48
5.4.310.0090.03512.48
5.4.300.0070.03612.48
5.4.290.0060.03712.48
5.4.280.0080.03412.38
5.4.270.0050.03712.38
5.4.260.0110.04612.38
5.4.250.0070.03812.38
5.4.240.0040.03712.38
5.4.230.0060.03712.37
5.4.220.0060.03712.37
5.4.210.0070.03312.37
5.4.200.0080.03412.37
5.4.190.0070.03512.36
5.4.180.0070.03312.37
5.4.170.0080.03412.38
5.4.160.0080.04012.38
5.4.150.0070.03612.37
5.4.140.0060.03612.05
5.4.130.0060.03512.04
5.4.120.0060.03412.00
5.4.110.0060.03411.99
5.4.100.0040.03611.99
5.4.90.0040.04512.00
5.4.80.0080.03411.99
5.4.70.0070.03311.99
5.4.60.0090.03311.99
5.4.50.0100.03011.99
5.4.40.0050.04111.98
5.4.30.0060.03511.98
5.4.20.0070.03311.98
5.4.10.0060.03411.98
5.4.00.0090.03711.47
5.3.290.0060.03912.80
5.3.280.0050.04412.71
5.3.270.0060.03812.72
5.3.260.0070.03812.72
5.3.250.0050.03712.72
5.3.240.0070.03512.72
5.3.230.0070.03512.71
5.3.220.0090.03912.68
5.3.210.0060.03812.68
5.3.200.0050.04212.68
5.3.190.0060.03812.68
5.3.180.0060.03612.67
5.3.170.0090.03512.67
5.3.160.0030.04012.67
5.3.150.0080.04012.67
5.3.140.0060.04212.66
5.3.130.0050.04012.66
5.3.120.0070.04012.66
5.3.110.0080.04212.66
5.3.100.0030.04812.11
5.3.90.0060.03512.10
5.3.80.0030.03712.09
5.3.70.0090.03512.09
5.3.60.0090.04212.07
5.3.50.0030.04312.02
5.3.40.0050.03612.02
5.3.30.0040.03711.98
5.3.20.0050.03511.76
5.3.10.0110.02911.73
5.3.00.0040.03711.71
5.2.170.0050.0309.22
5.2.160.0090.0259.22
5.2.150.0050.0309.22
5.2.140.0070.0289.22
5.2.130.0020.0319.18
5.2.120.0060.0279.18
5.2.110.0040.0299.18
5.2.100.0060.0279.18
5.2.90.0070.0279.17
5.2.80.0060.0299.17
5.2.70.0040.0339.17
5.2.60.0020.0329.13
5.2.50.0080.0269.10
5.2.40.0040.0289.07
5.2.30.0030.0319.05
5.2.20.0050.0289.04
5.2.10.0040.0288.96
5.2.00.0050.0338.81
5.1.60.0040.0238.10
5.1.50.0060.0228.10
5.1.40.0050.0248.08
5.1.30.0050.0258.44
5.1.20.0030.0318.46
5.1.10.0070.0258.18
5.1.00.0050.0278.18
5.0.50.0050.0186.66
5.0.40.0040.0276.52
5.0.30.0040.0306.34
5.0.20.0040.0196.30
5.0.10.0040.0186.28
5.0.00.0050.0386.28
4.4.90.0040.0134.78
4.4.80.0010.0164.75
4.4.70.0020.0224.76
4.4.60.0030.0174.75
4.4.50.0080.0144.77
4.4.40.0020.0274.71
4.4.30.0050.0194.76
4.4.20.0060.0124.84
4.4.10.0020.0164.85
4.4.00.0070.0224.76
4.3.110.0050.0164.67
4.3.100.0050.0154.66
4.3.90.0020.0164.63
4.3.80.0020.0274.58
4.3.70.0010.0154.63
4.3.60.0010.0154.63
4.3.50.0020.0154.62
4.3.40.0050.0264.53
4.3.30.0040.0193.33
4.3.20.0030.0193.30
4.3.10.0010.0183.26
4.3.00.0130.01715.97

preferences:
40.88 ms | 401 KiB | 5 Q