3v4l.org

run code in 300+ PHP versions simultaneously
<?php $key = "translations.fr.idTranslation"; $value = 4; $keys = explode('.', $key); $x = count($keys) - 1; $temp = array($keys[$x] => $value); for($i = $x-1; $i >= 0; $i--) { $temp = array($keys[$i] => $temp); } var_dump($temp);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 22, Position 2 = 16
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 22, Position 2 = 16
Branch analysis from position: 22
Branch analysis from position: 16
filename:       /in/3HBAY
function name:  (null)
number of ops:  26
compiled vars:  !0 = $key, !1 = $value, !2 = $keys, !3 = $x, !4 = $temp, !5 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, 'translations.fr.idTranslation'
    5     1        ASSIGN                                                   !1, 4
    6     2        INIT_FCALL                                               'explode'
          3        SEND_VAL                                                 '.'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $8      
          6        ASSIGN                                                   !2, $8
    8     7        COUNT                                            ~10     !2
          8        SUB                                              ~11     ~10, 1
          9        ASSIGN                                                   !3, ~11
    9    10        FETCH_DIM_R                                      ~13     !2, !3
         11        INIT_ARRAY                                       ~14     !1, ~13
         12        ASSIGN                                                   !4, ~14
   10    13        SUB                                              ~16     !3, 1
         14        ASSIGN                                                   !5, ~16
         15      > JMP                                                      ->20
   12    16    >   FETCH_DIM_R                                      ~18     !2, !5
         17        INIT_ARRAY                                       ~19     !4, ~18
         18        ASSIGN                                                   !4, ~19
   10    19        PRE_DEC                                                  !5
         20    >   IS_SMALLER_OR_EQUAL                                      0, !5
         21      > JMPNZ                                                    ~22, ->16
   14    22    >   INIT_FCALL                                               'var_dump'
         23        SEND_VAR                                                 !4
         24        DO_ICALL                                                 
         25      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157 ms | 1400 KiB | 17 Q