3v4l.org

run code in 300+ PHP versions simultaneously
<?php #$str = 'subvar'; #var_dump(explode(':',$str)); exit; $arr = array('var'=> 'notouch'); function strAssign(&$arr,$str,$val){ if(!empty($str)){ $str = explode(':',$str); $key = array_shift($str); if(gettype($arr[$key])!='array' || !isset($arr[$key])){ $arr[$key] = array(); } strAssign($arr[$key],implode(':',$str),$val); }else{ $arr = $val; } } 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/jb0Qj
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>
   18     1        INIT_FCALL                                               'strassign'
          2        SEND_REF                                                 !0
          3        SEND_VAL                                                 'var%3Asub%3Asub2'
          4        SEND_VAL                                                 'value'
          5        DO_FCALL                                      0          
   19     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 = 37
Branch analysis from position: 6
2 jumps found. (Code = 47) Position 1 = 19, Position 2 = 22
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 25
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
Branch analysis from position: 22
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jb0Qj
function name:  strAssign
number of ops:  39
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, ->37
    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        FETCH_DIM_R                                      ~10     !0, !3
         16        GET_TYPE                                         ~11     ~10
         17        IS_NOT_EQUAL                                     ~12     ~11, 'array'
         18      > JMPNZ_EX                                         ~12     ~12, ->22
         19    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~13     !0, !3
         20        BOOL_NOT                                         ~14     ~13
         21        BOOL                                             ~12     ~14
         22    > > JMPZ                                                     ~12, ->25
   11    23    >   ASSIGN_DIM                                               !0, !3
         24        OP_DATA                                                  <array>
   13    25    >   INIT_FCALL_BY_NAME                                       'strAssign'
         26        CHECK_FUNC_ARG                                           
         27        FETCH_DIM_FUNC_ARG                               $16     !0, !3
         28        SEND_FUNC_ARG                                            $16
         29        INIT_FCALL                                               'implode'
         30        SEND_VAL                                                 '%3A'
         31        SEND_VAR                                                 !1
         32        DO_ICALL                                         $17     
         33        SEND_VAR_NO_REF_EX                                       $17
         34        SEND_VAR_EX                                              !2
         35        DO_FCALL                                      0          
         36      > JMP                                                      ->38
   15    37    >   ASSIGN                                                   !0, !2
   17    38    > > RETURN                                                   null

End of function strassign

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.4 ms | 1394 KiB | 22 Q