3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = 'doom2:'; var_dump(implode(':',explode(':',$str))); exit; $arr = array('var'=> array('sub2' => 'notouch')); function strAssign(&$arr,$str,$val){ if(!empty($str)){ $str = explode(':',$str); $key = array_shift($str); if((isset($arr[$key]) && 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 = 79) Position 1 = -2
filename:       /in/U8i8L
function name:  (null)
number of ops:  23
compiled vars:  !0 = $str, !1 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'doom2%3A'
    4     1        INIT_FCALL                                               'var_dump'
          2        INIT_FCALL                                               'implode'
          3        SEND_VAL                                                 '%3A'
          4        INIT_FCALL                                               'explode'
          5        SEND_VAL                                                 '%3A'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $3      
          8        SEND_VAR                                                 $3
          9        DO_ICALL                                         $4      
         10        SEND_VAR                                                 $4
         11        DO_ICALL                                                 
         12      > EXIT                                                     
    5    13*       ASSIGN                                                   !1, <array>
   18    14*       INIT_FCALL                                               'strassign'
         15*       SEND_REF                                                 !1
         16*       SEND_VAL                                                 'var%3Asub%3Asub2%3A'
         17*       SEND_VAL                                                 'value'
         18*       DO_FCALL                                      0          
   19    19*       INIT_FCALL                                               'var_dump'
         20*       SEND_VAR                                                 !1
         21*       DO_ICALL                                                 
         22*     > RETURN                                                   1

Function strassign:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 40
Branch analysis from position: 6
2 jumps found. (Code = 46) Position 1 = 17, Position 2 = 21
Branch analysis from position: 17
2 jumps found. (Code = 47) Position 1 = 22, Position 2 = 25
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 28
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
Branch analysis from position: 25
Branch analysis from position: 21
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/U8i8L
function name:  strAssign
number of ops:  42
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, ->40
    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      > JMPZ_EX                                          ~10     ~10, ->21
         17    >   FETCH_DIM_R                                      ~11     !0, !3
         18        GET_TYPE                                         ~12     ~11
         19        IS_NOT_EQUAL                                     ~13     ~12, 'array'
         20        BOOL                                             ~10     ~13
         21    > > JMPNZ_EX                                         ~10     ~10, ->25
         22    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~14     !0, !3
         23        BOOL_NOT                                         ~15     ~14
         24        BOOL                                             ~10     ~15
         25    > > JMPZ                                                     ~10, ->28
   11    26    >   ASSIGN_DIM                                               !0, !3
         27        OP_DATA                                                  <array>
   13    28    >   INIT_FCALL_BY_NAME                                       'strAssign'
         29        CHECK_FUNC_ARG                                           
         30        FETCH_DIM_FUNC_ARG                               $17     !0, !3
         31        SEND_FUNC_ARG                                            $17
         32        INIT_FCALL                                               'implode'
         33        SEND_VAL                                                 '%3A'
         34        SEND_VAR                                                 !1
         35        DO_ICALL                                         $18     
         36        SEND_VAR_NO_REF_EX                                       $18
         37        SEND_VAR_EX                                              !2
         38        DO_FCALL                                      0          
         39      > JMP                                                      ->41
   15    40    >   ASSIGN                                                   !0, !2
   17    41    > > RETURN                                                   null

End of function strassign

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
193.03 ms | 1403 KiB | 22 Q