3v4l.org

run code in 300+ PHP versions simultaneously
<?php $utf8_str = "\xf0\x9f\x92\xa9"; $ret = ''; $length = mb_strlen($utf8_str, 'UTF-8'); for ($i = 0; $i < $length; $i++) { $char = mb_substr($utf8_str, $i, 1, 'UTF-8'); $l = strlen($char); if ($l <= 3) { $ret .= $char; } elseif ($l === 4) { $ret .= self::convert_char_to_cesu8($char); }// UTF-8で5文字以上になる文字はUnicodeとして不正なので無視(除去する) } $unko = $ret; var_dump($unko); $encode = json_encode($unko); var_dump($encode);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 9
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 22
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 9
Branch analysis from position: 31
Branch analysis from position: 9
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 28
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 9
Branch analysis from position: 31
Branch analysis from position: 9
Branch analysis from position: 28
filename:       /in/tRCEs
function name:  (null)
number of ops:  43
compiled vars:  !0 = $utf8_str, !1 = $ret, !2 = $length, !3 = $i, !4 = $char, !5 = $l, !6 = $unko, !7 = $encode
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%F0%9F%92%A9'
    4     1        ASSIGN                                                   !1, ''
    5     2        INIT_FCALL                                               'mb_strlen'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 'UTF-8'
          5        DO_ICALL                                         $10     
          6        ASSIGN                                                   !2, $10
    6     7        ASSIGN                                                   !3, 0
          8      > JMP                                                      ->29
    7     9    >   INIT_FCALL                                               'mb_substr'
         10        SEND_VAR                                                 !0
         11        SEND_VAR                                                 !3
         12        SEND_VAL                                                 1
         13        SEND_VAL                                                 'UTF-8'
         14        DO_ICALL                                         $13     
         15        ASSIGN                                                   !4, $13
    8    16        STRLEN                                           ~15     !4
         17        ASSIGN                                                   !5, ~15
    9    18        IS_SMALLER_OR_EQUAL                                      !5, 3
         19      > JMPZ                                                     ~17, ->22
   10    20    >   ASSIGN_OP                                     8          !1, !4
         21      > JMP                                                      ->28
   11    22    >   IS_IDENTICAL                                             !5, 4
         23      > JMPZ                                                     ~19, ->28
   12    24    >   INIT_STATIC_METHOD_CALL                                  'convert_char_to_cesu8'
         25        SEND_VAR_EX                                              !4
         26        DO_FCALL                                      0  $20     
         27        ASSIGN_OP                                     8          !1, $20
    6    28    >   PRE_INC                                                  !3
         29    >   IS_SMALLER                                               !3, !2
         30      > JMPNZ                                                    ~23, ->9
   16    31    >   ASSIGN                                                   !6, !1
   17    32        INIT_FCALL                                               'var_dump'
         33        SEND_VAR                                                 !6
         34        DO_ICALL                                                 
   18    35        INIT_FCALL                                               'json_encode'
         36        SEND_VAR                                                 !6
         37        DO_ICALL                                         $26     
         38        ASSIGN                                                   !7, $26
   19    39        INIT_FCALL                                               'var_dump'
         40        SEND_VAR                                                 !7
         41        DO_ICALL                                                 
         42      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
182.72 ms | 1400 KiB | 21 Q