3v4l.org

run code in 300+ PHP versions simultaneously
<?php $row = array( 'useless' => 42, 'useful' => 'orange', 'useless_too' => 'banana', 'useful_too' => 'apples'); foreach ($row as $key1=>$value){ $pos = strpos($key1,'useful'); if($pos==-1) unset($row[$key1]); } print_r($row);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 13
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 13
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 12
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 12
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/d7F9o
function name:  (null)
number of ops:  18
compiled vars:  !0 = $row, !1 = $value, !2 = $key1, !3 = $pos
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    7     1      > FE_RESET_R                                       $5      !0, ->13
          2    > > FE_FETCH_R                                       ~6      $5, !1, ->13
          3    >   ASSIGN                                                   !2, ~6
    8     4        INIT_FCALL                                               'strpos'
          5        SEND_VAR                                                 !2
          6        SEND_VAL                                                 'useful'
          7        DO_ICALL                                         $8      
          8        ASSIGN                                                   !3, $8
    9     9        IS_EQUAL                                                 !3, -1
         10      > JMPZ                                                     ~10, ->12
   10    11    >   UNSET_DIM                                                !0, !2
    7    12    > > JMP                                                      ->2
         13    >   FE_FREE                                                  $5
   14    14        INIT_FCALL                                               'print_r'
         15        SEND_VAR                                                 !0
         16        DO_ICALL                                                 
         17      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.36 ms | 1386 KiB | 17 Q