3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = ["a" => "aaa", "b.a" => "123456", "a.d.e" => "1%1"]; function l($name) { $keys = explode(".", $name); $key = array_shift($keys); $result = isset($a[$key]) ? $a[$key] : null; 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/FXrcI
function name:  (null)
number of ops:  27
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   25     1        INIT_FCALL                                               'var_dump'
          2        INIT_FCALL                                               'l'
          3        SEND_VAL                                                 'a'
          4        DO_FCALL                                      0  $2      
          5        SEND_VAR                                                 $2
          6        DO_ICALL                                                 
   26     7        INIT_FCALL                                               'var_dump'
          8        INIT_FCALL                                               'l'
          9        SEND_VAL                                                 'b.a'
         10        DO_FCALL                                      0  $4      
         11        SEND_VAR                                                 $4
         12        DO_ICALL                                                 
   27    13        INIT_FCALL                                               'var_dump'
         14        INIT_FCALL                                               'l'
         15        SEND_VAL                                                 'b.c'
         16        DO_FCALL                                      0  $6      
         17        SEND_VAR                                                 $6
         18        DO_ICALL                                                 
   28    19        INIT_FCALL                                               'var_dump'
         20        INIT_FCALL                                               'l'
         21        SEND_VAL                                                 'a.d.e'
         22        SEND_VAL                                                 45
         23        DO_FCALL                                      0  $8      
         24        SEND_VAR                                                 $8
         25        DO_ICALL                                                 
         26      > RETURN                                                   1

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

End of function l

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.36 ms | 1403 KiB | 25 Q