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; } ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Ktj8h
function name:  (null)
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL_BY_NAME                                       '_test'
          1        DO_FCALL                                      0          
   53     2      > RETURN                                                   1

Function _test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Ktj8h
function name:  _test
number of ops:  21
compiled vars:  !0 = $cntnts, !1 = $rplyCntnt, !2 = $pstvctgry, !3 = $ngtvctgry
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   INIT_FCALL_BY_NAME                                       '_illegal_character_remove'
          1        SEND_VAL_EX                                              '%E3%81%82%E3%81%84%E3%81%86%F0%9F%98%80%E3%81%88%E3%81%8A'
          2        DO_FCALL                                      0  $4      
          3        ASSIGN                                                   !0, $4
    9     4        INIT_FCALL_BY_NAME                                       '_illegal_character_remove'
          5        SEND_VAL_EX                                              '%E3%81%8B%E3%81%8D%F0%A0%80%8B%E3%81%8F%E3%81%91%E3%81%93'
          6        DO_FCALL                                      0  $6      
          7        ASSIGN                                                   !1, $6
   10     8        INIT_FCALL_BY_NAME                                       '_illegal_character_remove'
          9        SEND_VAL_EX                                              '%E3%81%95%E3%81%97%E3%81%99%F0%9F%8D%BA%E3%81%9B%E3%81%9D'
         10        DO_FCALL                                      0  $8      
         11        ASSIGN                                                   !2, $8
   11    12        INIT_FCALL_BY_NAME                                       '_illegal_character_remove'
         13        SEND_VAL_EX                                              '%E3%81%9F%E3%81%A1%F0%9F%8D%A3%E3%81%A4%E3%81%A6%E3%81%A8'
         14        DO_FCALL                                      0  $10     
         15        ASSIGN                                                   !3, $10
   13    16        ECHO                                                     !0
   14    17        ECHO                                                     !1
   15    18        ECHO                                                     !2
   16    19        ECHO                                                     !3
   18    20      > RETURN                                                   null

End of function _test

Function _illegal_character_remove:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 14, Position 2 = 34
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 34
Branch analysis from position: 15
2 jumps found. (Code = 46) Position 1 = 18, Position 2 = 24
Branch analysis from position: 18
2 jumps found. (Code = 46) Position 1 = 25, Position 2 = 31
Branch analysis from position: 25
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 33
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 33
Branch analysis from position: 31
Branch analysis from position: 24
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 34
filename:       /in/Ktj8h
function name:  _illegal_character_remove
number of ops:  38
compiled vars:  !0 = $arg, !1 = $repArr, !2 = $str, !3 = $retStr, !4 = $strArr, !5 = $strS
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
   22     1        ASSIGN                                                   !1, <array>
   35     2        INIT_FCALL                                               'preg_replace'
          3        SEND_VAR                                                 !1
          4        SEND_VAL                                                 ''
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $7      
          7        ASSIGN                                                   !2, $7
   38     8        ASSIGN                                                   !3, ''
   40     9        INIT_FCALL                                               'str_split'
         10        SEND_VAR                                                 !2
         11        DO_ICALL                                         $10     
         12        ASSIGN                                                   !4, $10
   42    13      > FE_RESET_R                                       $12     !4, ->34
         14    > > FE_FETCH_R                                               $12, !5, ->34
   43    15    >   STRLEN                                           ~13     !5
         16        IS_SMALLER                                       ~14     ~13, 4
         17      > JMPZ_EX                                          ~14     ~14, ->24
         18    >   INIT_FCALL                                               'htmlspecialchars_decode'
         19        SEND_VAL                                                 '%26%2365038'
         20        SEND_VAL                                                 3
         21        DO_ICALL                                         $15     
         22        IS_NOT_EQUAL                                     ~16     !5, $15
         23        BOOL                                             ~14     ~16
         24    > > JMPZ_EX                                          ~14     ~14, ->31
         25    >   INIT_FCALL                                               'htmlspecialchars_decode'
         26        SEND_VAL                                                 '%26%2365039'
         27        SEND_VAL                                                 3
         28        DO_ICALL                                         $17     
         29        IS_NOT_EQUAL                                     ~18     !5, $17
         30        BOOL                                             ~14     ~18
         31    > > JMPZ                                                     ~14, ->33
   44    32    >   ASSIGN_OP                                     8          !3, !5
   42    33    > > JMP                                                      ->14
         34    >   FE_FREE                                                  $12
   48    35        ASSIGN                                                   !2, !3
   50    36      > RETURN                                                   !2
   52    37*     > RETURN                                                   null

End of function _illegal_character_remove

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
127.95 ms | 1005 KiB | 16 Q