3v4l.org

run code in 300+ PHP versions simultaneously
<?php function parse_emojis(string $string) { static $emojis; if(!isset($emojis)) { $emojis = [ 'bbb' => json_decode(json_encode("\u{1F6A3}")), ]; } $tok = strtok($string, ":"); while($tok !== false) { yield isset($emojis[$tok]) ? $emojis[$tok] : $tok; $tok = strtok(":"); } } foreach(parse_emojis('ok :bbb: bbl') as $part) { print "$part"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/5EFop
function name:  (null)
number of ops:  10
compiled vars:  !0 = $part
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   INIT_FCALL                                               'parse_emojis'
          1        SEND_VAL                                                 'ok+%3Abbb%3A+bbl'
          2        DO_FCALL                                      0  $1      
          3      > FE_RESET_R                                       $2      $1, ->8
          4    > > FE_FETCH_R                                               $2, !0, ->8
   23     5    >   CAST                                          6  ~3      !0
          6        ECHO                                                     ~3
   21     7      > JMP                                                      ->4
          8    >   FE_FREE                                                  $2
   24     9      > RETURN                                                   1

Function parse_emojis:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 14
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
2 jumps found. (Code = 44) Position 1 = 33, Position 2 = 20
Branch analysis from position: 33
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 25
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
2 jumps found. (Code = 44) Position 1 = 33, Position 2 = 20
Branch analysis from position: 33
Branch analysis from position: 20
Branch analysis from position: 25
2 jumps found. (Code = 44) Position 1 = 33, Position 2 = 20
Branch analysis from position: 33
Branch analysis from position: 20
Branch analysis from position: 14
filename:       /in/5EFop
function name:  parse_emojis
number of ops:  34
compiled vars:  !0 = $string, !1 = $emojis, !2 = $tok
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        GENERATOR_CREATE                                         
    5     2        BIND_STATIC                                              !1
    6     3        ISSET_ISEMPTY_CV                                 ~3      !1
          4        BOOL_NOT                                         ~4      ~3
          5      > JMPZ                                                     ~4, ->14
    9     6    >   INIT_FCALL                                               'json_decode'
          7        INIT_FCALL                                               'json_encode'
          8        SEND_VAL                                                 '%F0%9F%9A%A3'
          9        DO_ICALL                                         $5      
         10        SEND_VAR                                                 $5
         11        DO_ICALL                                         $6      
         12        INIT_ARRAY                                       ~7      $6, 'bbb'
    8    13        ASSIGN                                                   !1, ~7
   13    14    >   INIT_FCALL                                               'strtok'
         15        SEND_VAR                                                 !0
         16        SEND_VAL                                                 '%3A'
         17        DO_ICALL                                         $9      
         18        ASSIGN                                                   !2, $9
   14    19      > JMP                                                      ->31
   16    20    >   ISSET_ISEMPTY_DIM_OBJ                         0          !1, !2
         21      > JMPZ                                                     ~11, ->25
         22    >   FETCH_DIM_R                                      ~12     !1, !2
         23        QM_ASSIGN                                        ~13     ~12
         24      > JMP                                                      ->26
         25    >   QM_ASSIGN                                        ~13     !2
         26    >   YIELD                                                    ~13
   17    27        INIT_FCALL                                               'strtok'
         28        SEND_VAL                                                 '%3A'
         29        DO_ICALL                                         $15     
         30        ASSIGN                                                   !2, $15
   14    31    >   TYPE_CHECK                                  1018          !2
         32      > JMPNZ                                                    ~17, ->20
   19    33    > > GENERATOR_RETURN                                         

End of function parse_emojis

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
179.51 ms | 1403 KiB | 20 Q