3v4l.org

run code in 300+ PHP versions simultaneously
<?php $now = array(12,14); $all = array( array( "lid" => 4, "name" => "aaaaa" ), array( "lid" => 12, "name" => "s" ), array( "lid" => 13, "name" => "aaa" ), array( "lid" => 14, "name" => "bbb" ) ); $i = 0; foreach ( $all as $each ) { if ( in_array($each,$now) ) { $all[$i]['ext'] = 1; } else { $all[$i]['ext'] = 0; } $i++; } print_r($all); foreach ($all as &$item) { $item['ext'] = (in_array($item['lid'], $now) ? 1 : 0); } print_r($item);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 19
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 19
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 14
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 19
2 jumps found. (Code = 125) Position 1 = 24, Position 2 = 37
Branch analysis from position: 24
2 jumps found. (Code = 126) Position 1 = 25, Position 2 = 37
Branch analysis from position: 25
2 jumps found. (Code = 43) Position 1 = 31, Position 2 = 33
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 37
Branch analysis from position: 19
filename:       /in/bitKa
function name:  (null)
number of ops:  42
compiled vars:  !0 = $now, !1 = $all, !2 = $i, !3 = $each, !4 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1        ASSIGN                                                   !1, <array>
   26     2        ASSIGN                                                   !2, 0
   27     3      > FE_RESET_R                                       $8      !1, ->19
          4    > > FE_FETCH_R                                               $8, !3, ->19
   28     5    >   INIT_FCALL                                               'in_array'
          6        SEND_VAR                                                 !3
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $9      
          9      > JMPZ                                                     $9, ->14
   29    10    >   FETCH_DIM_W                                      $10     !1, !2
         11        ASSIGN_DIM                                               $10, 'ext'
         12        OP_DATA                                                  1
         13      > JMP                                                      ->17
   31    14    >   FETCH_DIM_W                                      $12     !1, !2
         15        ASSIGN_DIM                                               $12, 'ext'
         16        OP_DATA                                                  0
   33    17    >   PRE_INC                                                  !2
   27    18      > JMP                                                      ->4
         19    >   FE_FREE                                                  $8
   35    20        INIT_FCALL                                               'print_r'
         21        SEND_VAR                                                 !1
         22        DO_ICALL                                                 
   36    23      > FE_RESET_RW                                      $16     !1, ->37
         24    > > FE_FETCH_RW                                              $16, !4, ->37
   37    25    >   INIT_FCALL                                               'in_array'
         26        FETCH_DIM_R                                      ~18     !4, 'lid'
         27        SEND_VAL                                                 ~18
         28        SEND_VAR                                                 !0
         29        DO_ICALL                                         $19     
         30      > JMPZ                                                     $19, ->33
         31    >   QM_ASSIGN                                        ~20     1
         32      > JMP                                                      ->34
         33    >   QM_ASSIGN                                        ~20     0
         34    >   ASSIGN_DIM                                               !4, 'ext'
         35        OP_DATA                                                  ~20
   36    36      > JMP                                                      ->24
         37    >   FE_FREE                                                  $16
   39    38        INIT_FCALL                                               'print_r'
         39        SEND_VAR                                                 !4
         40        DO_ICALL                                                 
         41      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.02 ms | 1400 KiB | 17 Q