3v4l.org

run code in 300+ PHP versions simultaneously
<?php if (!function_exists('codepoint_encode')) { function codepoint_encode($str) { return substr(json_encode($str), 1, -1); } } if (!function_exists('codepoint_decode')) { function codepoint_decode($str) { return json_decode(sprintf('"%s"', $str)); } } if (!function_exists('mb_internal_encoding')) { function mb_internal_encoding($encoding = NULL) { return ($from_encoding === NULL) ? iconv_get_encoding() : iconv_set_encoding($encoding); } } if (!function_exists('mb_convert_encoding')) { function mb_convert_encoding($str, $to_encoding, $from_encoding = NULL) { return iconv(($from_encoding === NULL) ? mb_internal_encoding() : $from_encoding, $to_encoding, $str); } } if (!function_exists('mb_chr')) { function mb_chr($ord, $encoding = 'UTF-8') { if ($encoding === 'UCS-4BE') { return pack("N", $ord); } else { return mb_convert_encoding(mb_chr($ord, 'UCS-4BE'), $encoding, 'UCS-4BE'); } } } if (!function_exists('mb_ord')) { function mb_ord($char, $encoding = 'UTF-8') { if ($encoding === 'UCS-4BE') { list(, $ord) = (strlen($char) === 4) ? @unpack('N', $char) : @unpack('n', $char); return $ord; } else { return mb_ord(mb_convert_encoding($char, 'UCS-4BE', $encoding), 'UCS-4BE'); } } } if (!function_exists('mb_htmlentities')) { function mb_htmlentities($string, $hex = true, $encoding = 'UTF-8') { return preg_replace_callback('/[\x{80}-\x{10FFFF}]/u', function ($match) use ($hex) { return sprintf($hex ? '&#x%X;' : '&#%d;', mb_ord($match[0])); }, $string); } } if (!function_exists('mb_html_entity_decode')) { function mb_html_entity_decode($string, $flags = null, $encoding = 'UTF-8') { return html_entity_decode($string, ($flags === NULL) ? ENT_COMPAT | ENT_HTML401 : $flags, $encoding); } } const EMOJIS = [ "00a9" => [["\u00A9\uFE0F", "\u00A9"], "\uE24E", "\uDBBA\uDF29", ["copyright"], 0, 0, 11, 0], "00ae" => [["\u00AE\uFE0F", "\u00AE"], "\uE24F", "\uDBBA\uDF2D", ["registered"], 0, 1, 11, 0], "203c" => [["\u203C\uFE0F", "\u203C"], "", "\uDBBA\uDF06", ["bangbang"], 0, 2, 15, 0] ]; function parse_emojis(string $string): string { preg_match_all('/(?<match>:.*:)/', $string, $matches, PREG_PATTERN_ORDER); $emojis = $matches['match']; foreach ($emojis as $emoji): $emoji_name = trim($emoji, ':'); foreach (EMOJIS as $key => $value): $names = $value[3]; foreach($names as $name): if ($name == $emoji_name): $string = str_replace($emoji, mb_chr('0x' . $key), $string); break; endif; endforeach; endforeach; endforeach; return $string; } var_dump(parse_emojis(' Ok. Nice :registered: Very very very nice :bangbang: Good. '));

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.00416.74
8.3.50.0160.00616.77
8.3.40.0160.00019.08
8.3.30.0120.00319.04
8.3.20.0030.00520.47
8.3.10.0040.00423.57
8.3.00.0040.00423.35
8.2.180.0080.00825.92
8.2.170.0190.00019.21
8.2.160.0070.00722.96
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0040.00422.37
8.2.120.0070.00026.35
8.2.110.0060.00322.23
8.2.100.0120.00018.09
8.2.90.0000.00819.47
8.2.80.0060.00318.13
8.2.70.0000.00818.00
8.2.60.0060.00318.05
8.2.50.0060.00318.41
8.2.40.0040.00422.30
8.2.30.0060.00619.42
8.2.20.0040.00418.14
8.2.10.0030.00518.11
8.2.00.0040.00418.11
8.1.280.0110.01125.92
8.1.270.0080.00023.99
8.1.260.0080.00026.35
8.1.250.0080.00028.09
8.1.240.0060.00323.80
8.1.230.0080.00322.78
8.1.220.0030.00618.04
8.1.210.0050.00518.90
8.1.200.0090.00017.73
8.1.190.0050.00317.48
8.1.180.0000.00918.10
8.1.170.0060.00318.80
8.1.160.0050.00318.87
8.1.150.0050.00218.84
8.1.140.0040.00417.77
8.1.130.0040.00419.05
8.1.120.0000.00717.66
8.1.110.0050.00317.68
8.1.100.0030.00617.60
8.1.90.0030.00417.68
8.1.80.0000.00717.74
8.1.70.0040.00417.70
8.1.60.0040.00417.83
8.1.50.0040.00417.68
8.1.40.0000.00817.64
8.1.30.0040.00417.78
8.1.20.0000.00817.97
8.1.10.0060.00317.80
8.1.00.0090.00017.75
8.0.300.0000.00820.26
8.0.290.0040.00416.88
8.0.280.0000.00818.58
8.0.270.0030.00317.39
8.0.260.0040.00417.12
8.0.250.0070.00017.26
8.0.240.0050.00317.13
8.0.230.0000.00717.13
8.0.220.0040.00417.21
8.0.210.0070.00017.15
8.0.200.0030.00317.25
8.0.190.0000.00817.30
8.0.180.0030.00617.25
8.0.170.0000.00717.12
8.0.160.0000.00817.28
8.0.150.0040.00417.11
8.0.140.0040.00817.18
8.0.130.0030.00313.62
8.0.120.0050.00317.09
8.0.110.0050.00317.11
8.0.100.0070.00017.09
8.0.90.0050.00217.24
8.0.80.0100.01017.16
8.0.70.0070.00017.00
8.0.60.0040.00417.00
8.0.50.0040.00417.24
8.0.30.0100.00817.31
8.0.20.0100.01017.43
8.0.10.0000.00717.31
8.0.00.0080.01517.16
7.4.330.0030.00316.68
7.4.320.0060.00016.81
7.4.300.0000.00716.80
7.4.290.0030.00316.80
7.4.280.0020.00516.72
7.4.270.0060.00316.83
7.4.260.0070.00016.90
7.4.250.0040.00416.69
7.4.240.0000.00816.89
7.4.230.0000.00716.70
7.4.220.0130.01516.83
7.4.210.0090.01216.91
7.4.200.0040.00416.98
7.4.160.0140.00616.84
7.4.150.0200.00717.40
7.4.140.0100.01117.86
7.4.130.0100.00716.70
7.4.120.0090.00816.77
7.4.110.0080.00816.65
7.4.100.0140.00416.77
7.4.90.0100.00716.98
7.4.80.0040.01419.39
7.4.70.0090.01116.59
7.4.60.0120.00716.68
7.4.50.0100.01016.80
7.4.40.0160.00716.57
7.4.30.0070.02116.56
7.4.20.0240.00516.61
7.4.10.0170.00816.78
7.4.00.0090.00815.70
7.3.330.0030.00313.59
7.3.320.0030.00313.58
7.3.310.0040.00416.48
7.3.300.0030.00316.64
7.3.290.0090.00816.57
7.3.280.0080.00916.58
7.3.270.0080.00817.40
7.3.260.0110.00716.83
7.3.250.0120.00616.78
7.3.240.0110.00716.74
7.3.230.0070.01016.90
7.3.210.0160.00316.84
7.3.200.0100.00717.01
7.3.190.0130.00816.76
7.3.180.0110.00916.69
7.3.170.0140.00616.71
7.3.160.0160.00716.68
7.3.150.0120.01516.91
7.3.140.0260.00616.75
7.3.130.0220.00716.71
7.3.120.0100.01115.71
7.3.110.0070.01415.70
7.3.100.0080.00915.50
7.3.90.0130.00715.72
7.3.80.0070.00715.65
7.3.70.0080.00715.46
7.3.60.0070.01115.53
7.3.50.0080.01215.51
7.3.40.0090.01115.63
7.3.30.0070.01115.66
7.3.20.0110.01016.73
7.3.10.0110.00816.81
7.3.00.0320.00716.92
7.2.330.0150.00317.03
7.2.320.0100.00716.94
7.2.310.0100.01216.89
7.2.300.0090.01216.85
7.2.290.0060.01616.89
7.2.280.0160.01316.74
7.2.270.0070.01516.82
7.2.260.0110.01516.81
7.2.250.0090.01215.64
7.2.240.0140.01015.90
7.2.230.0070.01115.86
7.2.220.0080.01416.04
7.2.210.0090.00815.72
7.2.200.0120.00515.97
7.2.190.0080.01015.81
7.2.180.0060.01115.85
7.2.170.0010.01615.89
7.2.160.0240.00616.88
7.2.150.0140.01416.96
7.2.140.0110.01916.92
7.2.130.0120.01316.94
7.2.120.0170.01416.92
7.2.110.0130.01016.84
7.2.100.0120.01716.99
7.2.90.0290.00016.94
7.2.80.0180.01516.82
7.2.70.0090.01216.72
7.2.60.0070.01117.02
7.2.50.0060.01616.78
7.2.40.0160.00716.95
7.2.30.0240.00516.93
7.2.20.0170.01116.81
7.2.10.0170.01216.73
7.2.00.0070.01816.78
7.1.330.0080.01116.06
7.1.320.0110.00615.74
7.1.310.0050.01015.96
7.1.300.0080.00715.84
7.1.290.0110.00915.85
7.1.280.0080.01115.95
7.1.270.0120.01016.06
7.1.260.0110.00615.78
7.1.250.0280.00315.85
7.1.240.0260.00515.88
7.1.230.0320.00315.73
7.1.220.0160.00615.90
7.1.210.0070.01315.69
7.1.200.0150.00616.01
7.1.190.0320.00016.01
7.1.180.0440.00315.85
7.1.170.0240.01415.65
7.1.160.0120.00915.66
7.1.150.0240.01216.02
7.1.140.0270.00815.92
7.1.130.0230.01215.91
7.1.120.0150.00915.78
7.1.110.0080.00817.12
7.1.100.0060.01317.19
7.1.90.0080.01017.06
7.1.80.0200.01017.07
7.1.70.0180.00816.66
7.1.60.0250.01425.67
7.1.50.0200.01025.45
7.1.40.0200.00425.27
7.1.30.0130.01425.32
7.1.20.0160.00925.29
7.1.10.0070.01116.23
7.1.00.0060.01016.42
7.0.330.0230.00815.73
7.0.320.0080.01115.33
7.0.310.0210.00715.51
7.0.300.0220.00815.46
7.0.290.0220.01115.26
7.0.280.0510.00715.51
7.0.270.0160.00615.48
7.0.260.0090.00615.70
7.0.250.0090.00916.96
7.0.240.0080.00916.54
7.0.230.0170.00816.80
7.0.220.0090.01216.77
7.0.210.0180.00316.23
7.0.200.0140.00616.19
7.0.190.0070.00916.33
7.0.180.0070.01016.02
7.0.170.0080.01216.03
7.0.160.0100.00516.05
7.0.150.0080.01016.06
7.0.140.0080.00815.95
7.0.130.0050.01115.94
7.0.120.0160.00416.07
7.0.110.0070.01216.07
7.0.100.0180.00715.88
7.0.90.0110.01216.01
7.0.80.0180.00616.20
7.0.70.0040.01316.02
7.0.60.0110.00616.00
7.0.50.0060.01216.08
7.0.40.0100.00616.02
7.0.30.0080.00816.29
7.0.20.0130.00716.21
7.0.10.0080.01115.99
7.0.00.0120.00816.02
5.6.400.0060.01715.68
5.6.390.0220.01415.75
5.6.380.0100.01415.76
5.6.370.0250.00615.91
5.6.360.0210.01115.68
5.6.350.0250.00815.66
5.6.340.0130.02215.85
5.6.330.0060.01915.77
5.6.320.0070.02315.58
5.6.310.0220.00715.79
5.6.300.0070.01915.79
5.6.290.0080.01615.47
5.6.280.0040.01515.83
5.6.270.0110.01115.57
5.6.260.0070.01415.69
5.6.250.0230.00815.60
5.6.240.0180.01815.82
5.6.230.0170.01315.76
5.6.220.0040.01615.90
5.6.210.0100.01315.64
5.6.200.0070.01315.51
5.6.190.0030.01715.66
5.6.180.0030.01616.05
5.6.170.0150.00515.75
5.6.160.0100.01715.65
5.6.150.0140.00815.88
5.6.140.0080.01415.70
5.6.130.0140.00915.41
5.6.120.0150.00915.62
5.6.110.0220.01415.63
5.6.100.0260.00715.84
5.6.90.0260.00915.74
5.6.80.0210.01315.69
5.6.70.0170.01515.51
5.6.60.0160.01315.58
5.6.50.0180.01115.57
5.6.40.0230.01315.69
5.6.30.0230.00915.68
5.6.20.0200.01015.41
5.6.10.0200.01015.61
5.6.00.0150.01515.74

preferences:
60.51 ms | 400 KiB | 5 Q