3v4l.org

run code in 300+ PHP versions simultaneously
<?php $results = [ ['name' => 'Benjoe', 'number' => '001'], ['name' => 'Benjoe', 'number' => '002'], ['name' => 'Benjoe', 'number' => '001'], ]; function compare($log1, $log2, $index1, $index2) { return $log1['name'] == $log2['name'] && $log1['number'] == $log2['number'] && $index1 != $index2; } foreach($results as $index1 => $log1) { foreach ($results as $index2 => $log2) { if (compare($log1, $log2, $index1, $index2)) { echo "Item {$index1} has a duplicate at index {$index2}!<br/>\n"; } } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 23
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 23
Branch analysis from position: 3
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 21
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 21
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 20
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 20
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 21
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
filename:       /in/CIdA6
function name:  (null)
number of ops:  25
compiled vars:  !0 = $results, !1 = $log1, !2 = $index1, !3 = $log2, !4 = $index2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   17     1      > FE_RESET_R                                       $6      !0, ->23
          2    > > FE_FETCH_R                                       ~7      $6, !1, ->23
          3    >   ASSIGN                                                   !2, ~7
   18     4      > FE_RESET_R                                       $9      !0, ->21
          5    > > FE_FETCH_R                                       ~10     $9, !3, ->21
          6    >   ASSIGN                                                   !4, ~10
   19     7        INIT_FCALL                                               'compare'
          8        SEND_VAR                                                 !1
          9        SEND_VAR                                                 !3
         10        SEND_VAR                                                 !2
         11        SEND_VAR                                                 !4
         12        DO_FCALL                                      0  $12     
         13      > JMPZ                                                     $12, ->20
   20    14    >   ROPE_INIT                                     5  ~14     'Item+'
         15        ROPE_ADD                                      1  ~14     ~14, !2
         16        ROPE_ADD                                      2  ~14     ~14, '+has+a+duplicate+at+index+'
         17        ROPE_ADD                                      3  ~14     ~14, !4
         18        ROPE_END                                      4  ~13     ~14, '%21%3Cbr%2F%3E%0A'
         19        ECHO                                                     ~13
   18    20    > > JMP                                                      ->5
         21    >   FE_FREE                                                  $9
   17    22      > JMP                                                      ->2
         23    >   FE_FREE                                                  $6
   23    24      > RETURN                                                   1

Function compare:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 8, Position 2 = 12
Branch analysis from position: 8
2 jumps found. (Code = 46) Position 1 = 13, Position 2 = 15
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
Branch analysis from position: 12
filename:       /in/CIdA6
function name:  compare
number of ops:  17
compiled vars:  !0 = $log1, !1 = $log2, !2 = $index1, !3 = $index2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
   11     4        FETCH_DIM_R                                      ~4      !0, 'name'
          5        FETCH_DIM_R                                      ~5      !1, 'name'
          6        IS_EQUAL                                         ~6      ~4, ~5
          7      > JMPZ_EX                                          ~6      ~6, ->12
   12     8    >   FETCH_DIM_R                                      ~7      !0, 'number'
          9        FETCH_DIM_R                                      ~8      !1, 'number'
         10        IS_EQUAL                                         ~9      ~7, ~8
         11        BOOL                                             ~6      ~9
         12    > > JMPZ_EX                                          ~6      ~6, ->15
   13    13    >   IS_NOT_EQUAL                                     ~10     !2, !3
         14        BOOL                                             ~6      ~10
         15    > > RETURN                                                   ~6
   14    16*     > RETURN                                                   null

End of function compare

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.06 ms | 1407 KiB | 14 Q