3v4l.org

run code in 300+ PHP versions simultaneously
<?php // PHP < 7.2 // https://github.com/symfony/polyfill-mbstring/blob/master/Mbstring.php#L708-L730 if( ! function_exists("mb_ord") ) { function mb_ord($s) { if (1 === \strlen($s)) { return \ord($s); } $code = ($s = unpack('C*', substr($s, 0, 4))) ? $s[1] : 0; if (0xF0 <= $code) { return (($code - 0xF0) << 18) + (($s[2] - 0x80) << 12) + (($s[3] - 0x80) << 6) + $s[4] - 0x80; } if (0xE0 <= $code) { return (($code - 0xE0) << 12) + (($s[2] - 0x80) << 6) + $s[3] - 0x80; } if (0xC0 <= $code) { return (($code - 0xC0) << 6) + $s[2] - 0x80; } return $code; } } function ord2seqlen($ord) { if($ord < 128){ return 1; } else if($ord < 224) { return 2; } else if($ord < 240) { return 3; } else if($ord < 248) { return 4; } else { throw new \Exception("No support for 5 or 6 byte sequences."); } } function utf8_seq_iter($input) { for($i=0,$c=strlen($input); $i<$c; ) { $bytes = ord2seqlen(ord($input[$i])); yield substr($input, $i, $bytes); $i += $bytes; } } function escape_codepoint($codepoint, $skip_low=true) { $ord = mb_ord($codepoint); if( $skip_low && $ord < 128 ) { return $codepoint; } else { return sprintf("\\u%04x", $ord); } } $input = "आए थे पर्यटक, खुद ही बह गए"; $output = ''; foreach( utf8_seq_iter($input) as $codepoint ) { $output .= escape_codepoint($codepoint); } var_dump($output);

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.0090.00618.43
8.3.50.0070.00716.73
8.3.40.0120.00618.78
8.3.30.0100.00618.64
8.3.20.0000.00821.02
8.3.10.0060.00321.94
8.3.00.0080.00022.36
8.2.180.0160.00616.88
8.2.170.0110.00422.96
8.2.160.0070.01021.01
8.2.150.0050.00324.18
8.2.140.0070.00324.66
8.2.130.0060.00326.16
8.2.120.0060.00320.87
8.2.110.0030.00721.01
8.2.100.0090.00317.91
8.2.90.0080.00319.26
8.2.80.0040.00417.97
8.2.70.0060.00317.63
8.2.60.0030.00618.03
8.2.50.0070.00318.07
8.2.40.0000.00818.29
8.2.30.0000.00718.15
8.2.20.0000.00718.30
8.2.10.0050.00219.43
8.2.00.0000.00718.28
8.1.280.0110.01125.92
8.1.270.0040.00420.37
8.1.260.0030.00726.35
8.1.250.0050.00328.09
8.1.240.0070.00417.36
8.1.230.0030.00722.08
8.1.220.0000.00917.78
8.1.210.0060.00318.77
8.1.200.0030.00617.35
8.1.190.0040.00417.36
8.1.180.0040.00418.10
8.1.170.0000.00918.71
8.1.160.0050.00218.91
8.1.150.0040.00419.10
8.1.140.0040.00419.07
8.1.130.0000.00717.48
8.1.120.0050.00217.54
8.1.110.0030.00517.53
8.1.100.0050.00517.47
8.1.90.0000.00817.59
8.1.80.0050.00217.52
8.1.70.0000.00717.60
8.1.60.0030.00517.71
8.1.50.0040.00417.64
8.1.40.0030.00617.64
8.1.30.0000.00817.71
8.1.20.0050.00317.77
8.1.10.0000.00717.75
8.1.00.0030.00617.55
8.0.300.0040.00418.77
8.0.290.0040.00417.00
8.0.280.0030.00318.55
8.0.270.0070.00017.37
8.0.260.0030.00317.00
8.0.250.0030.00317.07
8.0.240.0000.00716.95
8.0.230.0000.00817.11
8.0.220.0040.00417.00
8.0.210.0000.00716.95
8.0.200.0070.00017.09
8.0.190.0000.00817.06
8.0.180.0030.00517.01
8.0.170.0040.00417.02
8.0.160.0020.00517.02
8.0.150.0060.00316.90
8.0.140.0000.00716.96
8.0.130.0000.00613.39
8.0.120.0040.00416.99
8.0.110.0050.00216.96
8.0.100.0030.00516.82
8.0.90.0040.00417.00
8.0.80.0070.01416.98
8.0.70.0030.00516.84
8.0.60.0040.00416.79
8.0.50.0050.00217.06
8.0.30.0130.00717.11
8.0.20.0030.01817.07
8.0.10.0000.00716.92
8.0.00.0090.01016.72
7.4.330.0050.00016.77
7.4.320.0030.00316.77
7.4.300.0060.00016.55
7.4.290.0000.00716.60
7.4.280.0030.00616.72
7.4.270.0030.00716.70
7.4.260.0030.00316.65
7.4.250.0050.00316.54
7.4.240.0070.00016.55
7.4.230.0060.00016.61
7.4.220.0000.00716.64
7.4.210.0080.00916.73
7.4.200.0000.00716.78
7.4.160.0090.00716.56
7.4.140.0080.01117.86
7.4.130.0120.00416.58
7.4.120.0120.00616.66
7.4.110.0070.01016.62
7.4.100.0160.00616.46
7.4.90.0090.00616.62
7.4.80.0060.01219.39
7.4.70.0060.01216.52
7.4.60.0140.00916.47
7.4.50.0030.00916.54
7.4.40.0130.00316.44
7.4.00.0110.00414.65
7.3.330.0030.00313.39
7.3.320.0050.00013.32
7.3.310.0040.00416.54
7.3.300.0070.00016.44
7.3.290.0030.01016.53
7.3.280.0070.00916.44
7.3.260.0110.00716.52
7.3.240.0120.00516.65
7.3.230.0100.00716.36
7.3.210.0070.01016.38
7.3.200.0120.00316.39
7.3.190.0170.00016.40
7.3.180.0150.00616.73
7.3.170.0130.01016.68
7.3.160.0150.00616.51
7.3.30.0080.00214.67
7.3.20.0570.00514.91
7.3.10.0560.00914.71
7.3.00.0580.00515.00
7.2.330.0140.00316.70
7.2.320.0000.01916.90
7.2.310.0130.00616.79
7.2.300.0140.00316.81
7.2.290.0030.01416.81
7.2.160.0070.00315.07
7.2.150.0540.00515.30
7.2.140.0590.01415.03
7.2.130.0880.00715.29
7.2.120.0570.00215.05
7.2.110.0540.00715.37
7.2.100.0600.00515.21
7.2.90.0560.00815.11
7.2.80.0800.00815.15
7.2.70.0460.00715.25
7.2.60.0470.00715.08
7.2.50.0530.00315.02
7.2.40.0470.00215.21
7.2.30.0470.01014.90
7.2.20.0470.00914.96
7.2.10.0590.00315.06
7.2.00.0460.00215.09
7.1.270.0510.00713.96
7.1.260.0450.00813.90
7.1.250.0490.00313.85
7.1.240.0700.00914.25
7.1.230.0630.01313.95
7.1.220.0670.00014.09
7.1.210.0590.00614.07
7.1.200.0790.00413.98
7.1.190.0590.01213.89
7.1.180.0450.00914.13
7.1.170.0490.00714.12
7.1.160.0560.01014.13
7.1.150.0440.00614.20
7.1.140.0490.00714.00
7.1.130.0700.00714.01
7.1.120.0610.00714.00
7.1.110.0530.00813.82
7.1.100.0500.01013.98
7.1.90.0470.00714.16
7.1.80.0570.01213.95
7.1.70.0530.01414.14
7.1.60.0600.00314.06
7.1.50.0460.01314.15
7.1.40.0650.00313.93
7.1.30.0510.00713.82
7.1.20.0530.01513.97
7.1.10.0660.00714.04
7.1.00.0510.00613.99
7.0.330.0600.01013.61
7.0.320.0640.01013.64
7.0.310.0630.00313.52
7.0.300.0490.01613.65
7.0.290.0550.00813.69
7.0.280.0720.00013.40
7.0.270.0710.00313.64
7.0.260.0790.01313.81
7.0.250.0640.01213.73
7.0.240.0670.01113.65
7.0.230.0550.00413.53
7.0.220.0620.00713.64
7.0.210.1010.01213.85
7.0.200.0680.01213.43
7.0.190.0580.00613.50
7.0.180.0600.00413.75
7.0.170.0480.01013.71
7.0.160.0530.00313.54
7.0.150.0560.00913.69
7.0.140.0580.00413.67
7.0.130.0470.00813.43
7.0.120.0480.00713.53
7.0.110.0620.01013.48
7.0.100.0660.00713.39
7.0.90.0520.01013.75
7.0.80.0560.00813.65
7.0.70.0800.00013.60
7.0.60.0520.00613.76
7.0.50.0530.00713.80
7.0.40.0440.00913.50
7.0.30.0610.01013.79
7.0.20.0870.01313.84
7.0.10.0570.01313.61
7.0.00.0630.00313.80
5.6.400.0140.00714.63
5.6.390.0170.00014.44
5.6.380.0130.00314.57
5.6.370.0170.00914.33
5.6.360.0190.00013.89
5.6.350.0100.01314.43
5.6.340.0270.00414.66
5.6.330.0110.00814.41
5.6.320.0140.01414.67
5.6.310.0210.00714.24
5.6.300.0140.01114.70
5.6.290.0060.01614.22
5.6.280.0120.00914.56
5.6.270.0130.01014.48
5.6.260.0130.01714.54
5.6.250.0160.00914.56
5.6.240.0170.00814.45
5.6.230.0200.00314.30
5.6.220.0230.00914.57
5.6.210.0210.00914.39
5.6.200.0060.00914.30
5.6.190.0190.00914.37
5.6.180.0260.00714.30
5.6.170.0130.01314.45
5.6.160.0130.00614.39
5.6.150.0240.00014.32
5.6.140.0120.01714.45
5.6.130.0120.01214.38
5.6.120.0110.01114.32
5.6.110.0180.00914.73
5.6.100.0130.01014.23
5.6.90.0080.01614.32
5.6.80.0100.01014.36
5.6.70.0210.00714.53
5.6.60.0140.00714.36
5.6.50.0200.01014.27
5.6.40.0160.01614.33
5.6.30.0160.00314.30
5.6.20.0210.00314.30
5.6.10.0130.00414.42
5.6.00.0180.01214.17
5.5.380.0130.00514.63
5.5.370.0150.01814.32
5.5.360.0130.00314.39
5.5.350.0160.00514.47
5.5.340.0080.01114.16
5.5.330.0190.00814.38
5.5.320.0180.00514.46
5.5.310.0160.00314.49
5.5.300.0090.00914.51
5.5.290.0140.00714.08
5.5.280.0050.01414.54
5.5.270.0130.01114.25
5.5.260.0180.00014.68
5.5.250.0190.01114.22
5.5.240.0160.00014.27
5.5.230.0170.00314.09
5.5.220.0180.00614.24
5.5.210.0220.00914.23
5.5.200.0270.00814.19
5.5.190.0060.01714.50
5.5.180.0100.01514.40
5.5.170.0210.00314.18
5.5.160.0040.01914.25
5.5.150.0100.01014.16
5.5.140.0120.01513.96
5.5.130.0170.01414.11
5.5.120.0140.00914.38
5.5.110.0120.00914.03
5.5.100.0120.00814.02
5.5.90.0170.01014.08
5.5.80.0150.01514.46
5.5.70.0130.01314.16
5.5.60.0100.01514.21
5.5.50.0250.00314.51
5.5.40.0120.01614.26
5.5.30.0080.01114.36
5.5.20.0100.00314.12
5.5.10.0030.01614.53
5.5.00.0120.01214.03
5.4.450.0050.00511.83
5.4.440.0080.00411.83
5.4.430.0140.00611.83
5.4.420.0180.00011.83
5.4.410.0100.00411.83
5.4.400.0030.00911.83
5.4.390.0090.00511.83
5.4.380.0180.00011.83
5.4.370.0080.00411.83
5.4.360.0090.00611.83
5.4.350.0120.00811.83
5.4.340.0080.00411.83
5.4.330.0090.00311.83
5.4.320.0120.00911.83
5.4.310.0050.00511.83
5.4.300.0140.00011.83
5.4.290.0080.00811.83
5.4.280.0050.00511.83
5.4.270.0120.00411.83
5.4.260.0000.01111.83
5.4.250.0100.00211.83
5.4.240.0120.00611.83
5.4.230.0180.00311.83
5.4.220.0130.00911.83
5.4.210.0090.00511.83
5.4.200.0140.00011.83
5.4.190.0070.00211.83
5.4.180.0160.00011.83
5.4.170.0050.00511.83
5.4.160.0140.00711.83
5.4.150.0120.00011.83
5.4.140.0140.00911.83
5.4.130.0060.00911.83
5.4.120.0110.00611.83
5.4.110.0200.00011.83
5.4.100.0120.00011.83
5.4.90.0070.00211.83
5.4.80.0100.01011.83
5.4.70.0090.01311.83
5.4.60.0140.00611.83
5.4.50.0070.01111.83
5.4.40.0050.01111.83
5.4.30.0070.01411.83
5.4.20.0140.00611.83
5.4.10.0050.00511.83
5.4.00.0060.01311.83
5.3.290.0100.00711.83
5.3.280.0060.00411.83
5.3.270.0030.00611.83
5.3.260.0060.00911.83
5.3.250.0090.00911.83
5.3.240.0050.01011.83
5.3.230.0120.00011.83
5.3.220.0140.00311.83
5.3.210.0090.00611.83
5.3.200.0040.00411.83
5.3.190.0090.00211.83
5.3.180.0120.00911.83
5.3.170.0150.00811.83
5.3.160.0060.00611.83
5.3.150.0000.01311.83
5.3.140.0100.00011.83
5.3.130.0110.00311.83
5.3.120.0120.00811.83
5.3.110.0130.00011.83
5.3.100.0000.00911.83
5.3.90.0090.00011.83
5.3.80.0130.00311.83
5.3.70.0070.01311.83
5.3.60.0120.00511.83
5.3.50.0060.00611.83
5.3.40.0050.00911.83
5.3.30.0090.00011.83
5.3.20.0090.00911.83
5.3.10.0070.00411.83
5.3.00.0150.00611.83
5.2.170.0070.00211.83
5.2.160.0040.01111.83
5.2.150.0140.00311.83
5.2.140.0050.00311.83
5.2.130.0090.00311.83
5.2.120.0050.00711.83
5.2.110.0080.00011.83
5.2.100.0110.00011.83
5.2.90.0000.00811.83
5.2.80.0040.00611.83
5.2.70.0050.00511.83
5.2.60.0000.00811.83
5.2.50.0110.00311.83
5.2.40.0110.00311.83
5.2.30.0080.00411.83
5.2.20.0150.00011.83
5.2.10.0030.00711.83
5.2.00.0070.00311.83
5.1.60.0090.00011.83
5.1.50.0090.00011.83
5.1.40.0040.00411.83
5.1.30.0050.00511.83
5.1.20.0140.00311.83
5.1.10.0050.00811.83
5.1.00.0050.00511.83
5.0.50.0110.00011.83
5.0.40.0080.00811.83
5.0.30.0040.01111.83
5.0.20.0000.00611.83
5.0.10.0080.00011.83
5.0.00.0050.00311.83
4.4.90.0040.00411.83
4.4.80.0080.00411.83
4.4.70.0030.00311.83
4.4.60.0080.00411.83
4.4.50.0030.00311.83
4.4.40.0030.00311.83
4.4.30.0000.00611.83
4.4.20.0000.00611.83
4.4.10.0040.00211.83
4.4.00.0090.00211.83
4.3.110.0040.00811.83
4.3.100.0030.00311.83
4.3.90.0030.00311.83
4.3.80.0030.00311.83
4.3.70.0070.00411.83
4.3.60.0000.00711.83
4.3.50.0110.00011.83
4.3.40.0000.00711.83
4.3.30.0000.00511.83
4.3.20.0030.00311.83
4.3.10.0000.00411.83
4.3.00.0050.00011.83

preferences:
38.54 ms | 400 KiB | 5 Q