3v4l.org

run code in 300+ PHP versions simultaneously
<?php $c = ['one'=>['two' =>['t' => false]]]; $p = explode('.', 'one.two.tree'); $v = true; $cf = &$c; // Look for the key, creating nested keys if needed while ($part = array_shift($p)) { if (!isset($cf[$part]) && count($p)) { $cf[$part] = array(); } $cf = &$cf[$part]; } $cf = $v; var_dump($cf, $c);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 24, Position 2 = 9
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
2 jumps found. (Code = 46) Position 1 = 12, Position 2 = 14
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 17
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 24, Position 2 = 9
Branch analysis from position: 24
Branch analysis from position: 9
Branch analysis from position: 17
Branch analysis from position: 14
filename:       /in/71B2V
function name:  (null)
number of ops:  30
compiled vars:  !0 = $c, !1 = $p, !2 = $v, !3 = $cf, !4 = $part
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '.'
          3        SEND_VAL                                                 'one.two.tree'
          4        DO_ICALL                                         $6      
          5        ASSIGN                                                   !1, $6
    5     6        ASSIGN                                                   !2, <true>
    6     7        ASSIGN_REF                                               !3, !0
    8     8      > JMP                                                      ->19
    9     9    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~10     !3, !4
         10        BOOL_NOT                                         ~11     ~10
         11      > JMPZ_EX                                          ~11     ~11, ->14
         12    >   COUNT                                            ~12     !1
         13        BOOL                                             ~11     ~12
         14    > > JMPZ                                                     ~11, ->17
   10    15    >   ASSIGN_DIM                                               !3, !4
         16        OP_DATA                                                  <array>
   12    17    >   FETCH_DIM_W                                      $14     !3, !4
         18        ASSIGN_REF                                               !3, $14
    8    19    >   INIT_FCALL                                               'array_shift'
         20        SEND_REF                                                 !1
         21        DO_ICALL                                         $16     
         22        ASSIGN                                           ~17     !4, $16
         23      > JMPNZ                                                    ~17, ->9
   14    24    >   ASSIGN                                                   !3, !2
   16    25        INIT_FCALL                                               'var_dump'
         26        SEND_VAR                                                 !3
         27        SEND_VAR                                                 !0
         28        DO_ICALL                                                 
         29      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.48 ms | 1396 KiB | 19 Q