3v4l.org

run code in 300+ PHP versions simultaneously
<?php _test(); function _test(){ // 不正な文字を削除する $cntnts = _illegal_character_remove('あいう😀えお'); $rplyCntnt = _illegal_character_remove('かき𠀋くけこ'); $pstvctgry = _illegal_character_remove('さしす🍺せそ'); $ngtvctgry = _illegal_character_remove('たち🍣つてと'); echo $cntnts; echo $rplyCntnt; echo $pstvctgry; echo $ngtvctgry; } function _illegal_character_remove($arg) { $repArr = array( "/\xd83c[\xdf00-\xdfff]/", "/\xd83d[\xdc00-\xde4f]/", "/\xd83d[\xde80-\xdeff]/", "/\xd7c9[\xde00-\xdeff]/", "/[\x2600-\x27BF]/", "/[\x203C|\x2047-\x2049|\x2753-\x2757|\x2761-\x2767][\xFE0E-\xFE0F]/", "/[0-9|*|#][\xFE0E-\xFE0F]\x20E3/", "/[0-9|*|#]\x20E3/", "/[\x23E9-\x23FA]/", "/[\x23CF|\x25B6|\x25C0|\x2B05-\x2B07|\x2194-\x21AA|\x2934-\x2935|\x2122|©|®|\x3030|\x25FC-\x25FE][\xFE0E-\xFE0F]/", "/\xA4B3/" ); $str = preg_replace($repArr, '', $arg); // 新たな文字列を用意 $retStr = ''; // 文字列を配列にしたものを用意 $strArr = str_split($str); // 1文字1文字ずつ処理 foreach ($strArr as $strS) { if (strlen($strS) < 4 && htmlspecialchars_decode("&#65038", ENT_QUOTES) != $strS && htmlspecialchars_decode("&#65039", ENT_QUOTES) != $strS) { $retStr .= $strS; } } $str = $retStr; return $str; } ?>

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.120.0120.00822.20
8.4.110.0060.01222.40
8.4.100.0140.00718.26
8.4.90.0130.00818.77
8.4.80.0050.00320.01
8.4.70.0190.00618.37
8.4.60.0110.00918.75
8.4.50.0050.00318.04
8.4.40.0080.00418.80
8.4.30.0160.00318.93
8.4.20.0080.00018.30
8.4.10.0100.01023.73
8.3.250.0090.01018.98
8.3.240.0110.00916.99
8.3.230.0050.00316.72
8.3.220.0100.00817.15
8.3.210.0090.00916.93
8.3.200.0080.00417.09
8.3.190.0030.00518.91
8.3.180.0030.00716.79
8.3.170.0180.00019.10
8.3.160.0090.00916.91
8.3.150.0120.00617.01
8.3.140.0120.00620.67
8.3.130.0090.00018.58
8.3.120.0000.00919.21
8.3.110.0050.00320.94
8.3.100.0000.00816.86
8.3.90.0060.00326.77
8.3.80.0060.00318.43
8.3.70.0120.00316.88
8.3.60.0120.00918.43
8.3.50.0140.00716.91
8.3.40.0040.01121.97
8.3.30.0130.00318.97
8.3.20.0080.00024.18
8.3.10.0050.00324.66
8.3.00.0000.00826.16
8.2.290.0120.00620.43
8.2.280.0070.00718.81
8.2.270.0130.00616.60
8.2.260.0000.00917.11
8.2.250.0100.00016.85
8.2.240.0070.00719.11
8.2.230.0000.01022.58
8.2.220.0120.00324.06
8.2.210.0120.00626.77
8.2.200.0030.00617.00
8.2.190.0070.01416.75
8.2.180.0070.00725.92
8.2.170.0080.00819.09
8.2.160.0070.00722.96
8.2.150.0080.00025.66
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0050.00321.13
8.2.110.0090.00021.09
8.2.100.0040.00817.84
8.2.90.0000.00817.88
8.2.80.0090.00018.86
8.2.70.0080.00018.04
8.2.60.0080.00018.03
8.2.50.0080.00818.10
8.2.40.0060.00318.10
8.2.30.0100.00518.10
8.2.20.0130.00318.10
8.2.10.0070.00818.10
8.2.00.0090.00618.10
8.1.330.0130.00822.15
8.1.320.0080.01116.21
8.1.310.0070.00716.70
8.1.300.0000.00818.39
8.1.290.0030.00630.84
8.1.280.0110.00425.92
8.1.270.0080.00024.66
8.1.260.0060.00326.35
8.1.250.0000.00928.09
8.1.240.0060.00622.07
8.1.230.0100.00720.75
8.1.220.0040.00418.81
8.1.210.0050.00318.77
8.1.200.0060.00317.38
8.1.190.0030.00617.60
8.1.180.0000.00918.10
8.1.170.0100.00418.10
8.1.160.0080.00818.10
8.1.150.0110.00618.10
8.1.140.0110.00618.10
8.1.130.0130.00318.10
8.1.120.0100.00718.10
8.1.110.0080.00818.10
8.1.100.0110.00818.10
8.1.90.0130.00418.10
8.1.80.0140.00318.10
8.1.70.0180.00018.10
8.1.60.0120.00618.10
8.1.50.0090.01018.10
8.1.40.0140.00618.10
8.1.30.0110.00818.10
8.1.20.0160.00218.10
8.1.10.0130.00518.10
8.1.00.0090.00918.10
8.0.300.0000.00718.77
8.0.290.0000.00717.00
8.0.280.0160.00018.10
8.0.270.0110.00518.10
8.0.260.0130.00318.10
8.0.250.0110.00518.10
8.0.240.0140.00218.10
8.0.230.0080.00818.10
8.0.220.0120.00418.10
8.0.210.0170.00018.10
8.0.200.0140.00318.10
8.0.190.0110.00718.10
8.0.180.0100.00618.10
8.0.170.0090.00718.10
8.0.160.0080.00818.10
8.0.150.0150.00218.10
8.0.140.0160.00018.10
8.0.130.0130.00318.10
8.0.120.0210.00018.10
8.0.110.0120.00418.10
8.0.100.0160.00318.10
8.0.90.0130.00418.10
8.0.80.0150.00318.10
8.0.70.0100.00718.10
8.0.60.0130.00518.10
8.0.50.0070.01018.10
8.0.30.0080.00818.10
8.0.20.0110.00518.10
8.0.10.0120.00418.10

preferences:
26.37 ms | 403 KiB | 5 Q