3v4l.org

run code in 300+ PHP versions simultaneously
<?php // $a = ['item'=>['werwer'=>['tueiah'=>['auihi'=>'wieurh']]]; // $s = 'item.werwer.tueiah.auihi.wieurh'; $a = ['item'=>'werwer']; $s = 'item.werwer'; echo get($a, $s); // echo substr($s,0,strpos($s,'.'))."\n"; // echo substr($s,strpos($s,'.')+1)."\n"; function get($i, $c){ if(strpos($c,'.')){ $next = substr($s,0,strpos($s,'.')); $rem = substr($s,strpos($s,'.')+1); return get($i[$next], $rem); }else{ return $i[$c]; } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mGdHK
function name:  (null)
number of ops:  8
compiled vars:  !0 = $a, !1 = $s
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, <array>
    5     1        ASSIGN                                                   !1, 'item.werwer'
    7     2        INIT_FCALL_BY_NAME                                       'get'
          3        SEND_VAR_EX                                              !0
          4        SEND_VAR_EX                                              !1
          5        DO_FCALL                                      0  $4      
          6        ECHO                                                     $4
   19     7      > RETURN                                                   1

Function get:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 35
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mGdHK
function name:  get
number of ops:  38
compiled vars:  !0 = $i, !1 = $c, !2 = $next, !3 = $s, !4 = $rem
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   12     2        INIT_FCALL                                               'strpos'
          3        SEND_VAR                                                 !1
          4        SEND_VAL                                                 '.'
          5        DO_ICALL                                         $5      
          6      > JMPZ                                                     $5, ->35
   13     7    >   INIT_FCALL                                               'substr'
          8        SEND_VAR                                                 !3
          9        SEND_VAL                                                 0
         10        INIT_FCALL                                               'strpos'
         11        SEND_VAR                                                 !3
         12        SEND_VAL                                                 '.'
         13        DO_ICALL                                         $6      
         14        SEND_VAR                                                 $6
         15        DO_ICALL                                         $7      
         16        ASSIGN                                                   !2, $7
   14    17        INIT_FCALL                                               'substr'
         18        SEND_VAR                                                 !3
         19        INIT_FCALL                                               'strpos'
         20        SEND_VAR                                                 !3
         21        SEND_VAL                                                 '.'
         22        DO_ICALL                                         $9      
         23        ADD                                              ~10     $9, 1
         24        SEND_VAL                                                 ~10
         25        DO_ICALL                                         $11     
         26        ASSIGN                                                   !4, $11
   15    27        INIT_FCALL_BY_NAME                                       'get'
         28        CHECK_FUNC_ARG                                           
         29        FETCH_DIM_FUNC_ARG                               $13     !0, !2
         30        SEND_FUNC_ARG                                            $13
         31        SEND_VAR_EX                                              !4
         32        DO_FCALL                                      0  $14     
         33      > RETURN                                                   $14
         34*       JMP                                                      ->37
   17    35    >   FETCH_DIM_R                                      ~15     !0, !1
         36      > RETURN                                                   ~15
   19    37*     > RETURN                                                   null

End of function get

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.86 ms | 1400 KiB | 17 Q