3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* * preg_match() and //u pattern modifier * * @link https://stackoverflow.com/a/6723593/367456 */ $constants = function_exists('get_defined_constants') ? @get_defined_constants(true) : null; $pcreConstants = (array)@$constants['pcre']; $pcreConstants = null; if (empty($pcreConstants)) { $pcreConstants = array(); foreach (get_defined_constants() as $constant => $value) { if (6 === sscanf($constant, '%*[P]%*1[CR]%*1[RE]%*1[EG]%*[_]%n', $n)) { $pcreConstants[$constant] = $value; } } } $kMap = array_flip(array_keys($pcreConstants)); $ofVer = @$kMap['PCRE_VERSION']; $stop = $ofVer ? $ofVer : count($pcreConstants); $ofFirst = intval(@$kMap['PREG_NO_ERROR']); $errors = array_flip(array_slice($pcreConstants, $ofFirst, - $ofFirst + $stop)); $return = preg_match('//u', "\x80"); $matchesUTF8 = 1 === $return; $isMatchError = false === $return; $pregLastError = function_exists('preg_last_error') ? preg_last_error() : null; $pregLastErrorMsg = function_exists('preg_last_error_msg') ? preg_last_error_msg() : null; printf("\$return: %s\n", var_export($return, true)); printf("\$matchesUTF8: %s\n", var_export($matchesUTF8, true)); printf("\$isMatchError: %s\n", var_export($isMatchError, true)); printf("\$pregLastError: %s\n", var_export($pregLastError, true)); printf("\$pregLastErrorMsg: %s\n", var_export($pregLastErrorMsg, true)); printf("PREG_*_ERROR: %s\n", var_export(@$errors[$pregLastError], true)); printf("PCRE_VERSION: %s\n", @$pcreConstants['PCRE_VERSION']); $extPcreVer = function_exists('phpversion') ? @phpversion('pcre') : null; if ($extPcreVer === PHP_VERSION) $extPcreVer = 'PHP_VERSION'; printf("ext-pcre version: %s\n", var_export($extPcreVer, true)); echo 'pcre constants: ', print_r($pcreConstants, true);

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.4.20.0410.00617.65
8.4.10.0420.00717.82
8.3.150.0440.00316.84
8.3.140.0390.00516.80
8.3.130.0280.01016.81
8.3.120.0330.01016.76
8.3.110.0370.00416.68
8.3.100.0440.01016.72
8.3.90.0350.01116.71
8.3.80.0300.00916.80
8.3.70.0340.01216.86
8.3.60.0390.00617.16
8.3.50.0360.01016.95
8.3.40.0250.01417.71
8.3.30.0250.00517.87
8.3.20.0270.00917.93
8.3.10.0300.01117.94
8.3.00.0240.00718.00
8.2.270.0290.01216.72
8.2.260.0240.01417.07
8.2.250.0320.00716.87
8.2.240.0340.00517.04
8.2.230.0320.00616.78
8.2.220.0300.01016.82
8.2.210.0310.00816.72
8.2.200.0340.00816.80
8.2.190.0330.00716.83
8.2.180.0300.00916.87
8.2.170.0310.00818.07
8.2.160.0270.01218.12
8.2.150.0300.00718.00
8.2.140.0300.01017.71
8.2.130.0270.01218.02
8.2.120.0350.00717.93
8.2.110.0340.00917.73
8.2.100.0310.01317.85
8.2.90.0280.00918.02
8.2.80.0280.00317.87
8.2.70.0270.01118.01
8.2.60.0320.00617.82
8.2.50.0340.00417.87
8.2.40.0250.01217.73
8.2.30.0320.01317.78
8.2.20.0280.01017.91
8.2.10.0320.01117.77
8.2.00.0380.00817.89
8.1.310.0370.00616.28
8.1.300.0260.01116.69
8.1.290.0190.01916.41
8.1.280.0290.00916.73
8.1.270.0280.00917.65
8.1.260.0320.00617.68
8.1.250.0320.00617.85
8.1.240.0250.01117.45
8.1.230.0240.01117.51
8.1.220.0260.01017.44
8.1.210.0290.01017.46
8.1.200.0310.00717.44
8.1.190.0150.02617.37
8.1.180.0350.00417.44
8.1.170.0220.01317.43
8.1.160.0220.01317.73
8.1.150.0190.01417.65
8.1.140.0260.01017.36
8.1.130.0330.00717.31
8.1.120.0320.00317.59
8.1.110.0350.00017.48
8.1.100.0310.00017.56
8.1.90.0280.00017.59
8.1.80.0280.00817.32
8.1.70.0380.00017.60
8.1.60.0360.00017.66
8.1.50.0260.00517.73
8.1.40.0260.00717.58
8.1.30.0190.01617.75
8.1.20.0250.00617.77
8.1.10.0320.00317.50
8.1.00.0260.01017.58
8.0.300.0290.00616.70
8.0.290.0230.01316.88
8.0.280.0320.00316.70
8.0.270.0290.00716.78
8.0.260.0260.01416.81
8.0.250.0290.00816.88
8.0.240.0420.00616.98
8.0.230.0270.01416.96
8.0.220.0300.00516.91
8.0.210.0250.01117.05
8.0.200.0300.00717.07
8.0.190.0300.00616.96
8.0.180.0290.00717.02
8.0.170.0200.01616.71
8.0.160.0210.01417.04
8.0.150.0330.00316.83
8.0.140.0290.00616.93
8.0.130.0270.00916.86
8.0.120.0210.01417.04
8.0.110.0300.00616.97
8.0.100.0150.02016.92
8.0.90.0210.01516.77
8.0.80.0260.00616.71
8.0.70.0180.00516.91
8.0.60.0290.00716.89
8.0.50.0160.01616.86
8.0.30.0220.01317.07
8.0.20.0250.01117.22
8.0.10.0260.00917.10
8.0.00.0330.00316.95
7.4.330.0290.00616.81
7.4.320.0270.00616.54
7.4.300.0240.00916.79
7.4.290.0250.00716.73
7.4.280.0240.00916.82
7.4.270.0360.00716.43
7.4.260.0210.01216.48
7.4.250.0330.00016.50
7.4.240.0270.00616.48
7.4.230.0270.00616.49
7.4.220.0310.00316.43
7.4.210.0240.01416.69
7.4.200.0270.00716.73
7.4.190.0310.00416.53
7.4.180.0320.00316.85
7.4.160.0250.00916.73
7.4.150.0230.00616.91
7.4.140.0250.00416.60
7.4.130.0210.00816.68
7.4.120.0180.00716.71
7.4.110.0130.00716.75
7.4.100.0150.00316.68
7.4.90.0270.00616.73
7.4.80.0380.00916.73
7.4.70.0240.00716.62
7.4.60.0160.00416.65
7.4.50.0170.00416.48
7.4.40.0290.00316.45
7.4.30.0290.00316.66
7.4.20.0260.00616.33
7.4.10.0290.00316.67
7.4.00.0330.00316.60
7.3.330.0250.00716.17
7.3.320.0270.00616.31
7.3.310.0320.00016.63
7.3.300.0190.01316.65
7.3.290.0170.01416.54
7.3.280.0270.00716.38
7.3.270.0300.00416.29
7.3.260.0230.00916.48
7.3.250.0290.00316.23
7.3.240.0250.00716.58
7.3.230.0320.00016.46
7.3.220.0300.00416.36
7.3.210.0260.00716.27
7.3.200.0260.00716.37
7.3.190.0250.00716.21
7.3.180.0230.01116.09
7.3.170.0240.00916.27
7.3.160.0300.00416.11
7.3.150.0320.00616.17
7.3.140.0250.01016.17
7.3.130.0250.00816.32
7.3.120.0290.00316.22
7.3.110.0230.00916.11
7.3.100.0260.00716.21
7.3.90.0320.00316.35
7.3.80.0270.00616.45
7.3.70.0290.00316.61
7.3.60.0290.00416.45
7.3.50.0260.00616.41
7.3.40.0290.00316.65
7.3.30.0260.00616.39
7.3.20.0310.00318.16
7.3.10.0240.00818.18
7.3.00.0260.00717.84
7.2.340.0260.00716.49
7.2.330.0250.00716.50
7.2.320.0290.00416.60
7.2.310.0290.00316.25
7.2.300.0280.00716.36
7.2.290.0430.00016.66
7.2.280.0380.00016.66
7.2.270.0290.00416.52
7.2.260.0250.00716.48
7.2.250.0220.00616.59
7.2.240.0290.00316.77
7.2.230.0270.00316.67
7.2.220.0220.00716.58
7.2.210.0240.00916.72
7.2.200.0210.00716.86
7.2.190.0160.01316.54
7.2.180.0260.00716.76
7.2.170.0280.00416.78
7.2.160.0240.00816.89
7.2.150.0260.01118.25
7.2.140.0270.00618.45
7.2.130.0260.00618.43
7.2.120.0250.00818.38
7.2.110.0340.00418.18
7.2.100.0220.01018.41
7.2.90.0260.00718.47
7.2.80.0230.01018.48
7.2.70.0290.00418.49
7.2.60.0270.00618.44
7.2.50.0280.00618.14
7.2.40.0250.00818.45
7.2.30.0240.01018.20
7.2.20.0260.00318.48
7.2.10.0130.01818.21
7.2.00.0250.00718.46
7.1.330.0210.01017.33
7.1.320.0240.00516.94
7.1.310.0180.01117.21
7.1.300.0190.01017.26
7.1.290.0150.01516.96
7.1.280.0210.00817.05
7.1.270.0180.01116.89
7.1.260.0260.00316.79
7.1.250.0220.01117.01
7.1.240.0240.00617.21
7.1.230.0210.00817.26
7.1.220.0250.00617.25
7.1.210.0200.01017.16
7.1.200.0260.00316.99
7.1.190.0220.00617.06
7.1.180.0200.00817.18
7.1.170.0270.00017.23
7.1.160.0220.00716.98
7.1.150.0230.00616.99
7.1.140.0310.00017.01
7.1.130.0210.00916.88
7.1.120.0330.00316.98
7.1.110.0310.00817.37
7.1.100.0170.01317.05
7.1.90.0270.00317.32
7.1.80.0330.00017.14
7.1.70.0260.00317.08
7.1.60.0180.01117.28
7.1.50.0240.00617.38
7.1.40.0270.00617.07
7.1.30.0260.00317.58
7.1.20.0220.00917.20
7.1.10.0230.00717.43
7.1.00.0240.00517.29
7.0.330.0280.00316.92
7.0.320.0190.00916.88
7.0.310.0230.00616.89
7.0.300.0250.00417.04
7.0.290.0210.00717.04
7.0.280.0240.00716.90
7.0.270.0160.01316.89
7.0.260.0190.00916.79
7.0.250.0230.00617.20
7.0.240.0200.00617.07
7.0.230.0190.00717.07
7.0.220.0290.00016.94
7.0.210.0270.00416.87
7.0.200.0190.01216.98
7.0.190.0250.00316.77
7.0.180.0210.00716.93
7.0.170.0240.00417.02
7.0.160.0170.01316.72
7.0.150.0200.00916.93
7.0.140.0120.01516.96
7.0.130.0200.00316.99
7.0.120.0290.00017.25
7.0.110.0240.00716.72
7.0.100.0180.00316.84
7.0.90.0060.00616.90
7.0.80.0170.01016.83
7.0.70.0180.00716.91
7.0.60.0200.00516.59
7.0.50.0280.00016.88
7.0.40.0240.00716.97
7.0.30.0120.01616.62
7.0.20.0180.01116.85
7.0.10.0190.00916.78
7.0.00.0110.01516.68
5.6.400.0240.00615.99
5.6.390.0200.01015.98
5.6.380.0240.00616.14
5.6.370.0220.00715.98
5.6.360.0150.01516.09
5.6.350.0240.00615.89
5.6.340.0260.00415.84
5.6.330.0280.00715.83
5.6.320.0170.00715.98
5.6.310.0330.00615.71
5.6.300.0300.00715.90
5.6.290.0270.00416.27
5.6.280.0220.00815.78
5.6.270.0230.00716.08
5.6.260.0300.00015.96
5.6.250.0210.00816.17
5.6.240.0250.00415.87
5.6.230.0150.01516.34
5.6.220.0250.00416.12
5.6.210.0270.00316.23
5.6.200.0240.00616.41
5.6.190.0200.01016.32
5.6.180.0230.00716.46
5.6.170.0250.00716.30
5.6.160.0250.00616.25
5.6.150.0200.01016.29
5.6.140.0210.00916.48
5.6.130.0230.00716.39
5.6.120.0190.01516.13
5.6.110.0160.00816.30
5.6.100.0160.00816.05
5.6.90.0210.00615.92
5.6.80.0230.00716.00
5.6.70.0210.00916.14
5.6.60.0180.01415.95
5.6.50.0140.01416.10
5.6.40.0210.00816.20
5.6.30.0270.00315.89
5.6.20.0210.00916.05
5.6.10.0230.00616.05
5.6.00.0290.00816.02
5.5.380.0230.00816.36
5.5.370.0200.00716.46
5.5.360.0170.00715.97
5.5.350.0190.00316.05
5.5.340.0270.00316.05
5.5.330.0230.00816.06
5.5.320.0160.00816.05
5.5.310.0120.01215.96
5.5.300.0200.00915.88
5.5.290.0300.00016.26
5.5.280.0250.00615.76
5.5.270.0160.01016.00
5.5.260.0150.01515.90
5.5.250.0300.00016.17
5.5.240.0170.01116.10
5.5.230.0130.01016.14
5.5.220.0170.01116.23
5.5.210.0200.00916.13
5.5.200.0090.00416.18
5.5.190.0200.00816.00
5.5.180.0220.00616.25
5.5.170.0210.00715.97
5.5.160.0200.00816.17
5.5.150.0250.00316.01
5.5.140.0260.00315.79
5.5.130.0290.00715.82
5.5.120.0340.00515.82
5.5.110.0190.01016.08
5.5.100.0230.00516.13
5.5.90.0210.00815.85
5.5.80.0150.01516.11
5.5.70.0190.01016.27
5.5.60.0190.01315.70
5.5.50.0220.00415.99
5.5.40.0260.00415.49
5.5.30.0230.00616.07
5.5.20.0160.01315.91
5.5.10.0210.00815.74
5.5.00.0250.00415.93
5.4.450.0200.00314.65
5.4.440.0110.01114.65
5.4.430.0180.00614.65
5.4.420.0200.00414.65
5.4.410.0250.00014.65
5.4.400.0160.00814.65
5.4.390.0150.00414.65
5.4.380.0180.00614.65
5.4.370.0200.00314.65
5.4.360.0200.00314.65
5.4.350.0160.00614.65
5.4.340.0180.00514.65
5.4.330.0180.00514.65
5.4.320.0140.00614.65
5.4.310.0110.00714.65
5.4.300.0100.00214.65
5.4.290.0050.00514.65
5.4.280.0030.00714.65
5.4.270.0050.00514.65
5.4.260.0130.00714.65
5.4.250.0150.00914.65
5.4.240.0200.00314.65
5.4.230.0120.01214.65
5.4.220.0170.01014.65
5.4.210.0170.00714.65
5.4.200.0150.00914.65
5.4.190.0160.00614.65
5.4.180.0150.00314.65
5.4.170.0190.00414.65
5.4.160.0200.00314.65
5.4.150.0180.00514.65
5.4.140.0240.00014.65
5.4.130.0160.00614.65
5.4.120.0110.01114.65
5.4.110.0210.00314.65
5.4.100.0190.00414.65
5.4.90.0150.00814.65
5.4.80.0140.00814.65
5.4.70.0230.00014.65
5.4.60.0150.00714.65
5.4.50.0160.00614.65
5.4.40.0150.00814.65
5.4.30.0200.00314.65
5.4.20.0220.00014.65
5.4.10.0170.00314.65
5.4.00.0190.00314.65
5.3.290.0210.00314.65
5.3.280.0170.00614.65
5.3.270.0150.00914.65
5.3.260.0140.01014.65
5.3.250.0200.00414.65
5.3.240.0200.00314.65
5.3.230.0120.01214.65
5.3.220.0200.00414.65
5.3.210.0230.00814.65
5.3.200.0300.00314.65
5.3.190.0230.00014.65
5.3.180.0070.01514.65
5.3.170.0120.01214.65
5.3.160.0150.01114.65
5.3.150.0160.00814.65
5.3.140.0240.00014.65
5.3.130.0180.00514.65
5.3.120.0120.01214.65
5.3.110.0150.00814.65
5.3.100.0170.00714.65
5.3.90.0110.01114.65
5.3.80.0190.00414.65
5.3.70.0100.01314.65
5.3.60.0110.01114.65
5.3.50.0170.00314.65
5.3.40.0150.00814.65
5.3.30.0160.00614.65
5.3.20.0160.00614.65
5.3.10.0150.00814.65
5.3.00.0190.00414.65
5.2.170.0130.00614.65
5.2.160.0140.00514.65
5.2.150.0060.01314.65
5.2.140.0110.00814.65
5.2.130.0160.00314.65
5.2.120.0140.00514.65
5.2.110.0150.00514.65
5.2.100.0170.00314.65
5.2.90.0160.00314.65
5.2.80.0120.00414.65
5.2.70.0150.00414.65
5.2.60.0040.01114.65
5.2.50.0130.00314.65
5.2.40.0080.00814.65
5.2.30.0180.00414.65
5.2.20.0160.00414.65
5.2.10.0140.00414.65
5.2.00.0190.00014.65
5.1.60.0150.00314.65
5.1.50.0080.00814.65
5.1.40.0180.00014.65
5.1.30.0140.00414.65
5.1.20.0150.00314.65
5.1.10.0100.00714.65
5.1.00.0110.00614.65
5.0.50.0120.00414.65
5.0.40.0130.00314.65
5.0.30.0150.00014.65
5.0.20.0090.00614.65
5.0.10.0120.00314.65
5.0.00.0040.01114.65
4.4.90.0080.00014.65
4.4.80.0040.00414.65
4.4.70.0000.00914.65
4.4.60.0090.00014.65
4.4.50.0090.00014.65
4.4.40.0090.00014.65
4.4.30.0070.00214.65
4.4.20.0090.00014.65
4.4.10.0060.00314.65
4.4.00.0070.00214.65
4.3.110.0090.00014.65
4.3.100.0090.00014.65
4.3.90.0070.00214.65
4.3.80.0090.00014.65
4.3.70.0090.00014.65
4.3.60.0090.00014.65
4.3.50.0080.00014.65
4.3.40.0060.00314.65
4.3.30.0080.00014.65
4.3.20.0040.00414.65
4.3.10.0050.00314.65
4.3.00.0030.00514.65

preferences:
63.91 ms | 403 KiB | 5 Q