3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = ["a" => 2, "b" => 3, "c" => 1, "d" => 2]; $array2 = ["c" => 1, "d" => 1, "a" => 2, "b" => 3, "x" => 4, "z" => 1]; $count = 0; foreach($array1 as $key => $value){ $array_2_value = $array2[$key] ?? null; if($array_2_value !== null && $array_2_value === $value) $count++; } echo $count;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 17
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 17
Branch analysis from position: 5
2 jumps found. (Code = 46) Position 1 = 12, Position 2 = 14
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 16
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 16
Branch analysis from position: 14
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/BREbg
function name:  (null)
number of ops:  20
compiled vars:  !0 = $array1, !1 = $array2, !2 = $count, !3 = $value, !4 = $key, !5 = $array_2_value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, <array>
    6     2        ASSIGN                                                   !2, 0
    8     3      > FE_RESET_R                                       $9      !0, ->17
          4    > > FE_FETCH_R                                       ~10     $9, !3, ->17
          5    >   ASSIGN                                                   !4, ~10
    9     6        FETCH_DIM_IS                                     ~12     !1, !4
          7        COALESCE                                         ~13     ~12
          8        QM_ASSIGN                                        ~13     null
          9        ASSIGN                                                   !5, ~13
   10    10        TYPE_CHECK                                  1020  ~15     !5
         11      > JMPZ_EX                                          ~15     ~15, ->14
         12    >   IS_IDENTICAL                                     ~16     !5, !3
         13        BOOL                                             ~15     ~16
         14    > > JMPZ                                                     ~15, ->16
         15    >   PRE_INC                                                  !2
    8    16    > > JMP                                                      ->4
         17    >   FE_FREE                                                  $9
   13    18        ECHO                                                     !2
   14    19      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.13 ms | 941 KiB | 13 Q