3v4l.org

run code in 300+ PHP versions simultaneously
<?php function l($name) { $a = ["a" => "aaa", "b.a" => "123456", "a.d.e" => "1%1"]; $keys = explode(".", $name); $key = array_shift($keys); $result = isset($a[$key]) ? $a[$key] : null; print $a[$key]; foreach($keys as $k) { if(!$result) return $name; $result = $result[$k]; } $args = func_get_args(); foreach($args as $k => $v) $result = str_replace("%{$k}", $v, $result); return $result; } var_dump(l("a")); var_dump(l("b.a")); var_dump(l("b.c")); var_dump(l("a.d.e", 45));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mhaPY
function name:  (null)
number of ops:  26
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'l'
          2        SEND_VAL                                                 'a'
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
   29     6        INIT_FCALL                                               'var_dump'
          7        INIT_FCALL                                               'l'
          8        SEND_VAL                                                 'b.a'
          9        DO_FCALL                                      0  $2      
         10        SEND_VAR                                                 $2
         11        DO_ICALL                                                 
   30    12        INIT_FCALL                                               'var_dump'
         13        INIT_FCALL                                               'l'
         14        SEND_VAL                                                 'b.c'
         15        DO_FCALL                                      0  $4      
         16        SEND_VAR                                                 $4
         17        DO_ICALL                                                 
   31    18        INIT_FCALL                                               'var_dump'
         19        INIT_FCALL                                               'l'
         20        SEND_VAL                                                 'a.d.e'
         21        SEND_VAL                                                 45
         22        DO_FCALL                                      0  $6      
         23        SEND_VAR                                                 $6
         24        DO_ICALL                                                 
         25      > RETURN                                                   1

Function l:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 16
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
2 jumps found. (Code = 77) Position 1 = 21, Position 2 = 29
Branch analysis from position: 21
2 jumps found. (Code = 78) Position 1 = 22, Position 2 = 29
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 26
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
Branch analysis from position: 29
2 jumps found. (Code = 77) Position 1 = 33, Position 2 = 44
Branch analysis from position: 33
2 jumps found. (Code = 78) Position 1 = 34, Position 2 = 44
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
Branch analysis from position: 44
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 44
Branch analysis from position: 29
Branch analysis from position: 16
2 jumps found. (Code = 77) Position 1 = 21, Position 2 = 29
Branch analysis from position: 21
Branch analysis from position: 29
filename:       /in/mhaPY
function name:  l
number of ops:  47
compiled vars:  !0 = $name, !1 = $a, !2 = $keys, !3 = $key, !4 = $result, !5 = $k, !6 = $args, !7 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    7     1        ASSIGN                                                   !1, <array>
    8     2        INIT_FCALL                                               'explode'
          3        SEND_VAL                                                 '.'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $9      
          6        ASSIGN                                                   !2, $9
   10     7        INIT_FCALL                                               'array_shift'
          8        SEND_REF                                                 !2
          9        DO_ICALL                                         $11     
         10        ASSIGN                                                   !3, $11
   11    11        ISSET_ISEMPTY_DIM_OBJ                         0          !1, !3
         12      > JMPZ                                                     ~13, ->16
         13    >   FETCH_DIM_R                                      ~14     !1, !3
         14        QM_ASSIGN                                        ~15     ~14
         15      > JMP                                                      ->17
         16    >   QM_ASSIGN                                        ~15     null
         17    >   ASSIGN                                                   !4, ~15
   13    18        FETCH_DIM_R                                      ~17     !1, !3
         19        ECHO                                                     ~17
   15    20      > FE_RESET_R                                       $18     !2, ->29
         21    > > FE_FETCH_R                                               $18, !5, ->29
   17    22    >   BOOL_NOT                                         ~19     !4
         23      > JMPZ                                                     ~19, ->26
   18    24    >   FE_FREE                                                  $18
         25      > RETURN                                                   !0
   19    26    >   FETCH_DIM_R                                      ~20     !4, !5
         27        ASSIGN                                                   !4, ~20
   15    28      > JMP                                                      ->21
         29    >   FE_FREE                                                  $18
   22    30        FUNC_GET_ARGS                                    ~22     
         31        ASSIGN                                                   !6, ~22
   23    32      > FE_RESET_R                                       $24     !6, ->44
         33    > > FE_FETCH_R                                       ~25     $24, !7, ->44
         34    >   ASSIGN                                                   !5, ~25
   24    35        INIT_FCALL                                               'str_replace'
         36        NOP                                                      
         37        FAST_CONCAT                                      ~27     '%25', !5
         38        SEND_VAL                                                 ~27
         39        SEND_VAR                                                 !7
         40        SEND_VAR                                                 !4
         41        DO_ICALL                                         $28     
         42        ASSIGN                                                   !4, $28
   23    43      > JMP                                                      ->33
         44    >   FE_FREE                                                  $24
   25    45      > RETURN                                                   !4
   26    46*     > RETURN                                                   null

End of function l

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.85 ms | 1407 KiB | 25 Q