3v4l.org

run code in 500+ PHP versions simultaneously
<?php $jsonArr = [ 'vbas31' => [ 'enabled' => [0 => 'NO'], 'registered' => [0 => 'NO'] ], 'bnmsa1' => [ 'enabled' => [0 => 'YES'], 'registered' => [0 => 'NO'], 'compromised' => [0 => 'NO'] ] ]; $keysarr = array_keys($jsonArr); for($i = 0; $i < count($jsonArr); $i++) { foreach($jsonArr[$keysarr[$i]] as $key => $value) { // Inside inner loop - this works echo $keysarr[$i] . ": " . $key . ", " . $value[0] . "\n"; } // Outside inner loop - only shows last eleemnt // echo $keysarr[$i] . ": " . $key . ", " . $value[0] . "\n"; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 7
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 21
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 21
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 21
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 7
Branch analysis from position: 26
Branch analysis from position: 7
Branch analysis from position: 21
filename:       /in/sUDql
function name:  (null)
number of ops:  27
compiled vars:  !0 = $jsonArr, !1 = $keysarr, !2 = $i, !3 = $value, !4 = $key
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   15     1        INIT_FCALL                                                   'array_keys'
          2        SEND_VAR                                                     !0
          3        DO_ICALL                                             $6      
          4        ASSIGN                                                       !1, $6
   17     5        ASSIGN                                                       !2, 0
          6      > JMP                                                          ->23
   18     7    >   FETCH_DIM_R                                          ~9      !1, !2
          8        FETCH_DIM_R                                          ~10     !0, ~9
          9      > FE_RESET_R                                           $11     ~10, ->21
         10    > > FE_FETCH_R                                           ~12     $11, !3, ->21
         11    >   ASSIGN                                                       !4, ~12
   20    12        FETCH_DIM_R                                          ~14     !1, !2
         13        CONCAT                                               ~15     ~14, '%3A+'
         14        CONCAT                                               ~16     ~15, !4
         15        CONCAT                                               ~17     ~16, '%2C+'
         16        FETCH_DIM_R                                          ~18     !3, 0
         17        CONCAT                                               ~19     ~17, ~18
         18        CONCAT                                               ~20     ~19, '%0A'
         19        ECHO                                                         ~20
   18    20      > JMP                                                          ->10
         21    >   FE_FREE                                                      $11
   17    22        PRE_INC                                                      !2
         23    >   COUNT                                                ~22     !0
         24        IS_SMALLER                                                   !2, ~22
         25      > JMPNZ                                                        ~23, ->7
   24    26    > > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
158.8 ms | 1491 KiB | 14 Q