3v4l.org

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

End of function strassign

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
185.86 ms | 1403 KiB | 22 Q