3v4l.org

run code in 300+ PHP versions simultaneously
<?php $datas = [ [ 'id' => 2135, 'first_name' => 'John', 'last_name' => 'Doe', 'gender' => 'male' ], [ 'id' => 3245, 'first_name' => 'Sally', 'last_name' => 'Smith', 'gender' => 'female' ], [ 'id' => 5342, 'first_name' => 'Jane', 'last_name' => 'Doe', 'gender' => 'female' ], [ 'id' => 5623, 'first_name' => 'Peter', 'last_name' => 'Doe', 'gender' => 'male' ], [ 'id' => 7216, 'first_name' => 'Mike', 'last_name' => 'Lill', 'gender' => 'male' ] ]; $needles = ['Doe', 'male']; foreach ($datas as $row) { if (!array_diff($needles, $row)) { $result[] = $row; } } var_export($result); // reindexed already echo "\n---\n"; foreach ($datas as $index => $row) { if (array_diff($needles, $row)) { unset($datas[$index]); } } var_export($datas);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 13
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 13
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 12
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 12
Branch analysis from position: 13
2 jumps found. (Code = 77) Position 1 = 19, Position 2 = 28
Branch analysis from position: 19
2 jumps found. (Code = 78) Position 1 = 20, Position 2 = 28
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 27
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
Branch analysis from position: 27
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
Branch analysis from position: 13
filename:       /in/C8ujq
function name:  (null)
number of ops:  33
compiled vars:  !0 = $datas, !1 = $needles, !2 = $row, !3 = $result, !4 = $index
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   36     1        ASSIGN                                                   !1, <array>
   38     2      > FE_RESET_R                                       $7      !0, ->13
          3    > > FE_FETCH_R                                               $7, !2, ->13
   39     4    >   INIT_FCALL                                               'array_diff'
          5        SEND_VAR                                                 !1
          6        SEND_VAR                                                 !2
          7        DO_ICALL                                         $8      
          8        BOOL_NOT                                         ~9      $8
          9      > JMPZ                                                     ~9, ->12
   40    10    >   ASSIGN_DIM                                               !3
         11        OP_DATA                                                  !2
   38    12    > > JMP                                                      ->3
         13    >   FE_FREE                                                  $7
   43    14        INIT_FCALL                                               'var_export'
         15        SEND_VAR                                                 !3
         16        DO_ICALL                                                 
   45    17        ECHO                                                     '%0A---%0A'
   47    18      > FE_RESET_R                                       $12     !0, ->28
         19    > > FE_FETCH_R                                       ~13     $12, !2, ->28
         20    >   ASSIGN                                                   !4, ~13
   48    21        INIT_FCALL                                               'array_diff'
         22        SEND_VAR                                                 !1
         23        SEND_VAR                                                 !2
         24        DO_ICALL                                         $15     
         25      > JMPZ                                                     $15, ->27
   49    26    >   UNSET_DIM                                                !0, !4
   47    27    > > JMP                                                      ->19
         28    >   FE_FREE                                                  $12
   52    29        INIT_FCALL                                               'var_export'
         30        SEND_VAR                                                 !0
         31        DO_ICALL                                                 
         32      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
216.05 ms | 1007 KiB | 15 Q