3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array ( 'pubMessages' => array ( 0 => array ( 'msg' => 'Not bad', 'type' => 'warning', ), 1 => array ( 'msg' => 'Bad', 'type' => 'error', ), ), ); $dynamicKey = array_keys($array)[0]; foreach($array[$dynamicKey] as $key=>$item){ if ($item['type'] == 'error') unset($array[$dynamicKey][$key]); } var_dump($array);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 16
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 16
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 15
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 15
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/b3c1d
function name:  (null)
number of ops:  21
compiled vars:  !0 = $array, !1 = $dynamicKey, !2 = $item, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   18     1        INIT_FCALL                                               'array_keys'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $5      
          4        FETCH_DIM_R                                      ~6      $5, 0
          5        ASSIGN                                                   !1, ~6
   19     6        FETCH_DIM_R                                      ~8      !0, !1
          7      > FE_RESET_R                                       $9      ~8, ->16
          8    > > FE_FETCH_R                                       ~10     $9, !2, ->16
          9    >   ASSIGN                                                   !3, ~10
   20    10        FETCH_DIM_R                                      ~12     !2, 'type'
         11        IS_EQUAL                                                 ~12, 'error'
         12      > JMPZ                                                     ~13, ->15
   21    13    >   FETCH_DIM_UNSET                                  $14     !0, !1
         14        UNSET_DIM                                                $14, !3
   19    15    > > JMP                                                      ->8
         16    >   FE_FREE                                                  $9
   24    17        INIT_FCALL                                               'var_dump'
         18        SEND_VAR                                                 !0
         19        DO_ICALL                                                 
         20      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.27 ms | 1400 KiB | 17 Q