3v4l.org

run code in 300+ PHP versions simultaneously
<?php $fromBackend = [ 114466 => [ "BrandID" => 136, "record" => 114466 ], 114467 => [ "BrandID" => 1, "record" => 114467 ], 114468 => [ "BrandID" => 2, "record" => 114468 ] ]; $fromFrontEnd = array((object)['id' => 117, 'brandId' => 1], (object)['id' => 118, 'brandId' => 2]); $recordsToDelete = array(); foreach ($fromBackend as $backendItem) { foreach ($fromFrontEnd as $frontendItem) { if ($frontendItem->brandId == $backendItem['BrandID']) break; } if ($frontendItem->brandId != $backendItem['BrandID']) $recordsToDelete[] = $backendItem['record']; } print_r($recordsToDelete);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 26
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 26
Branch analysis from position: 9
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 17
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 17
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 16
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 25
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 25
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 17
Branch analysis from position: 17
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
filename:       /in/2UWPC
function name:  (null)
number of ops:  31
compiled vars:  !0 = $fromBackend, !1 = $fromFrontEnd, !2 = $recordsToDelete, !3 = $backendItem, !4 = $frontendItem
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   17     1        CAST                                          8  ~6      <array>
          2        INIT_ARRAY                                       ~7      ~6
   18     3        CAST                                          8  ~8      <array>
          4        ADD_ARRAY_ELEMENT                                ~7      ~8
   17     5        ASSIGN                                                   !1, ~7
   20     6        ASSIGN                                                   !2, <array>
   21     7      > FE_RESET_R                                       $11     !0, ->26
          8    > > FE_FETCH_R                                               $11, !3, ->26
   22     9    > > FE_RESET_R                                       $12     !1, ->17
         10    > > FE_FETCH_R                                               $12, !4, ->17
   23    11    >   FETCH_OBJ_R                                      ~13     !4, 'brandId'
         12        FETCH_DIM_R                                      ~14     !3, 'BrandID'
         13        IS_EQUAL                                                 ~13, ~14
         14      > JMPZ                                                     ~15, ->16
         15    > > JMP                                                      ->17
   22    16    > > JMP                                                      ->10
         17    >   FE_FREE                                                  $12
   25    18        FETCH_OBJ_R                                      ~16     !4, 'brandId'
         19        FETCH_DIM_R                                      ~17     !3, 'BrandID'
         20        IS_NOT_EQUAL                                             ~16, ~17
         21      > JMPZ                                                     ~18, ->25
         22    >   FETCH_DIM_R                                      ~20     !3, 'record'
         23        ASSIGN_DIM                                               !2
         24        OP_DATA                                                  ~20
   21    25    > > JMP                                                      ->8
         26    >   FE_FREE                                                  $11
   27    27        INIT_FCALL                                               'print_r'
         28        SEND_VAR                                                 !2
         29        DO_ICALL                                                 
         30      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.82 ms | 1396 KiB | 15 Q