3v4l.org

run code in 300+ PHP versions simultaneously
<?php function parse_emojis(string $string): string { preg_match_all('/(?<match>:.*:)/', $string, $matches, PREG_PATTERN_ORDER); $emojis = $matches['match']; foreach ($emojis as $emoji): $emoji_name = trim($emoji, ':'); foreach (EMOJIS as $key => $value): $names = $value[3]; foreach($names as $name): if ($name == $emoji_name): $string = str_replace($emoji, sprintf('\\u{%s}', $key), $string); break; endif; endforeach; endforeach; endforeach; console_log('$string', $string); return $string; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LeADO
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E > > RETURN                                                   1

Function parse_emojis:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 42
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 42
Branch analysis from position: 11
2 jumps found. (Code = 77) Position 1 = 18, Position 2 = 40
Branch analysis from position: 18
2 jumps found. (Code = 78) Position 1 = 19, Position 2 = 40
Branch analysis from position: 19
2 jumps found. (Code = 77) Position 1 = 23, Position 2 = 38
Branch analysis from position: 23
2 jumps found. (Code = 78) Position 1 = 24, Position 2 = 38
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 37
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
Branch analysis from position: 38
Branch analysis from position: 38
Branch analysis from position: 40
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 40
Branch analysis from position: 42
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 42
filename:       /in/LeADO
function name:  parse_emojis
number of ops:  51
compiled vars:  !0 = $string, !1 = $matches, !2 = $emojis, !3 = $emoji, !4 = $emoji_name, !5 = $value, !6 = $key, !7 = $names, !8 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        INIT_FCALL                                               'preg_match_all'
          2        SEND_VAL                                                 '%2F%28%3F%3Cmatch%3E%3A.%2A%3A%29%2F'
          3        SEND_VAR                                                 !0
          4        SEND_REF                                                 !1
          5        SEND_VAL                                                 1
          6        DO_ICALL                                                 
    6     7        FETCH_DIM_R                                      ~10     !1, 'match'
          8        ASSIGN                                                   !2, ~10
    8     9      > FE_RESET_R                                       $12     !2, ->42
         10    > > FE_FETCH_R                                               $12, !3, ->42
    9    11    >   INIT_FCALL                                               'trim'
         12        SEND_VAR                                                 !3
         13        SEND_VAL                                                 '%3A'
         14        DO_ICALL                                         $13     
         15        ASSIGN                                                   !4, $13
   11    16        FETCH_CONSTANT                                   ~15     'EMOJIS'
         17      > FE_RESET_R                                       $16     ~15, ->40
         18    > > FE_FETCH_R                                       ~17     $16, !5, ->40
         19    >   ASSIGN                                                   !6, ~17
   12    20        FETCH_DIM_R                                      ~19     !5, 3
         21        ASSIGN                                                   !7, ~19
   14    22      > FE_RESET_R                                       $21     !7, ->38
         23    > > FE_FETCH_R                                               $21, !8, ->38
   15    24    >   IS_EQUAL                                                 !8, !4
         25      > JMPZ                                                     ~22, ->37
   16    26    >   INIT_FCALL                                               'str_replace'
         27        SEND_VAR                                                 !3
         28        INIT_FCALL                                               'sprintf'
         29        SEND_VAL                                                 '%5Cu%7B%25s%7D'
         30        SEND_VAR                                                 !6
         31        DO_ICALL                                         $23     
         32        SEND_VAR                                                 $23
         33        SEND_VAR                                                 !0
         34        DO_ICALL                                         $24     
         35        ASSIGN                                                   !0, $24
   18    36      > JMP                                                      ->38
   14    37    > > JMP                                                      ->23
         38    >   FE_FREE                                                  $21
   11    39      > JMP                                                      ->18
         40    >   FE_FREE                                                  $16
    8    41      > JMP                                                      ->10
         42    >   FE_FREE                                                  $12
   24    43        INIT_FCALL_BY_NAME                                       'console_log'
         44        SEND_VAL_EX                                              '%24string'
         45        SEND_VAR_EX                                              !0
         46        DO_FCALL                                      0          
   26    47        VERIFY_RETURN_TYPE                                       !0
         48      > RETURN                                                   !0
   27    49*       VERIFY_RETURN_TYPE                                       
         50*     > RETURN                                                   null

End of function parse_emojis

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.87 ms | 1400 KiB | 21 Q