3v4l.org

run code in 300+ PHP versions simultaneously
<?php #$str = 'subvar'; #var_dump(explode(':',$str)); exit; $arr = array(); function strAssign(&$arr,$str,$val){ if(!empty($str)){ $str = explode(':',$str); $key = array_shift($str); $arr[$key] = array(); strAssign($arr[$key],implode(':',$str),$val); }else{ return true; } } strAssign($arr,'var:sub:sub2','value'); var_dump($arr);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PdMvH
function name:  (null)
number of ops:  10
compiled vars:  !0 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ASSIGN                                                   !0, <array>
   16     1        INIT_FCALL                                               'strassign'
          2        SEND_REF                                                 !0
          3        SEND_VAL                                                 'var%3Asub%3Asub2'
          4        SEND_VAL                                                 'value'
          5        DO_FCALL                                      0          
   17     6        INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                                 
          9      > RETURN                                                   1

Function strassign:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 29
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PdMvH
function name:  strAssign
number of ops:  31
compiled vars:  !0 = $arr, !1 = $str, !2 = $val, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
    7     3        ISSET_ISEMPTY_CV                                 ~4      !1
          4        BOOL_NOT                                         ~5      ~4
          5      > JMPZ                                                     ~5, ->29
    8     6    >   INIT_FCALL                                               'explode'
          7        SEND_VAL                                                 '%3A'
          8        SEND_VAR                                                 !1
          9        DO_ICALL                                         $6      
         10        ASSIGN                                                   !1, $6
    9    11        INIT_FCALL                                               'array_shift'
         12        SEND_REF                                                 !1
         13        DO_ICALL                                         $8      
         14        ASSIGN                                                   !3, $8
   10    15        ASSIGN_DIM                                               !0, !3
         16        OP_DATA                                                  <array>
   11    17        INIT_FCALL_BY_NAME                                       'strAssign'
         18        CHECK_FUNC_ARG                                           
         19        FETCH_DIM_FUNC_ARG                               $11     !0, !3
         20        SEND_FUNC_ARG                                            $11
         21        INIT_FCALL                                               'implode'
         22        SEND_VAL                                                 '%3A'
         23        SEND_VAR                                                 !1
         24        DO_ICALL                                         $12     
         25        SEND_VAR_NO_REF_EX                                       $12
         26        SEND_VAR_EX                                              !2
         27        DO_FCALL                                      0          
         28      > JMP                                                      ->30
   13    29    > > RETURN                                                   <true>
   15    30    > > RETURN                                                   null

End of function strassign

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.06 ms | 1394 KiB | 22 Q