3v4l.org

run code in 300+ PHP versions simultaneously
<?php $rows = [ (object)["guestEmail" => "you@booking.com"], (object)["guestEmail" => "you@okay.com"], (object)["guestEmail" => "me@booking.com"], (object)["guestEmail" => "n/a"], (object)["guestEmail" => "somebodyelse@booking.com"], (object)["guestEmail" => "youAgain@BOOKING.COM"] ]; $blacklist = ['@guest.booking.com', '@booking.com', 'N/A', 'n.c@hotel.com', 'n.c@hotels.com']; foreach ($rows as $row) { foreach ($blacklist as $b) { if (stripos($row->guestEmail, $b) !== false) { if (isset($blacklistedcounts[$b])) { // this important to avoid Notices ++$blacklistedcounts[$b]; // increment after the element key exists } else { $blacklistedcounts[$b] = 1; // set 1 on first occurrence } break; // no need to check for other matches for this guestEmail } } } var_export($blacklistedcounts);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 15, Position 2 = 36
Branch analysis from position: 15
2 jumps found. (Code = 78) Position 1 = 16, Position 2 = 36
Branch analysis from position: 16
2 jumps found. (Code = 77) Position 1 = 17, Position 2 = 34
Branch analysis from position: 17
2 jumps found. (Code = 78) Position 1 = 18, Position 2 = 34
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 33
Branch analysis from position: 25
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 30
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
Branch analysis from position: 34
Branch analysis from position: 34
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 36
filename:       /in/OvGDB
function name:  (null)
number of ops:  41
compiled vars:  !0 = $rows, !1 = $blacklist, !2 = $row, !3 = $b, !4 = $blacklistedcounts
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   CAST                                          8  ~5      <array>
          1        INIT_ARRAY                                       ~6      ~5
    4     2        CAST                                          8  ~7      <array>
          3        ADD_ARRAY_ELEMENT                                ~6      ~7
    5     4        CAST                                          8  ~8      <array>
          5        ADD_ARRAY_ELEMENT                                ~6      ~8
    6     6        CAST                                          8  ~9      <array>
          7        ADD_ARRAY_ELEMENT                                ~6      ~9
    7     8        CAST                                          8  ~10     <array>
          9        ADD_ARRAY_ELEMENT                                ~6      ~10
    8    10        CAST                                          8  ~11     <array>
         11        ADD_ARRAY_ELEMENT                                ~6      ~11
    2    12        ASSIGN                                                   !0, ~6
   10    13        ASSIGN                                                   !1, <array>
   12    14      > FE_RESET_R                                       $14     !0, ->36
         15    > > FE_FETCH_R                                               $14, !2, ->36
   13    16    > > FE_RESET_R                                       $15     !1, ->34
         17    > > FE_FETCH_R                                               $15, !3, ->34
   14    18    >   INIT_FCALL                                               'stripos'
         19        FETCH_OBJ_R                                      ~16     !2, 'guestEmail'
         20        SEND_VAL                                                 ~16
         21        SEND_VAR                                                 !3
         22        DO_ICALL                                         $17     
         23        TYPE_CHECK                                  1018          $17
         24      > JMPZ                                                     ~18, ->33
   15    25    >   ISSET_ISEMPTY_DIM_OBJ                         0          !4, !3
         26      > JMPZ                                                     ~19, ->30
   16    27    >   FETCH_DIM_RW                                     $20     !4, !3
         28        PRE_INC                                                  $20
   15    29      > JMP                                                      ->32
   18    30    >   ASSIGN_DIM                                               !4, !3
         31        OP_DATA                                                  1
   20    32    > > JMP                                                      ->34
   13    33    > > JMP                                                      ->17
         34    >   FE_FREE                                                  $15
   12    35      > JMP                                                      ->15
         36    >   FE_FREE                                                  $14
   24    37        INIT_FCALL                                               'var_export'
         38        SEND_VAR                                                 !4
         39        DO_ICALL                                                 
         40      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.33 ms | 1443 KiB | 15 Q