3v4l.org

run code in 500+ PHP versions simultaneously
<?php $a = [ "foo1", "faa2", "foo3", "fuu4", "faa5", "foo6", "fuuX", ]; function strposa($haystack, $needle, $offset=0) { if(!is_array($needle)) $needle = array($needle); foreach($needle as $query) { if(strpos($haystack, $query, $offset) !== false) return true; // stop on first true result } return false; } $r = []; foreach($a as $key => $value){ if(false === strposa($value, ['foo', 'faa'])){ $r[] = $value; } } var_dump($r);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 14
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 14
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 13
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 13
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/cZQ84
function name:  (null)
number of ops:  19
compiled vars:  !0 = $a, !1 = $r, !2 = $value, !3 = $key
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   21     1        ASSIGN                                                       !1, <array>
   22     2      > FE_RESET_R                                           $6      !0, ->14
          3    > > FE_FETCH_R                                           ~7      $6, !2, ->14
          4    >   ASSIGN                                                       !3, ~7
   23     5        INIT_FCALL                                                   'strposa'
          6        SEND_VAR                                                     !2
          7        SEND_VAL                                                     <array>
          8        DO_FCALL                                          0  $9      
          9        TYPE_CHECK                                        4          $9
         10      > JMPZ                                                         ~10, ->13
   24    11    >   ASSIGN_DIM                                                   !1
         12        OP_DATA                                                      !2
   22    13    > > JMP                                                          ->3
         14    >   FE_FREE                                                      $6
   28    15        INIT_FCALL                                                   'var_dump'
         16        SEND_VAR                                                     !1
         17        DO_ICALL                                                     
         18      > RETURN                                                       1

Function strposa:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 17
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 17
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 16
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
Branch analysis from position: 8
filename:       /in/cZQ84
function name:  strposa
number of ops:  20
compiled vars:  !0 = $haystack, !1 = $needle, !2 = $offset, !3 = $query
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   13     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        RECV_INIT                                            !2      0
   14     3        TYPE_CHECK                                      128  ~4      !1
          4        BOOL_NOT                                             ~5      ~4
          5      > JMPZ                                                         ~5, ->8
          6    >   INIT_ARRAY                                           ~6      !1
          7        ASSIGN                                                       !1, ~6
   15     8    > > FE_RESET_R                                           $8      !1, ->17
          9    > > FE_FETCH_R                                                   $8, !3, ->17
   16    10    >   FRAMELESS_ICALL_3                strpos              ~9      !0, !3
         11        OP_DATA                                                      !2
         12        TYPE_CHECK                                      1018          ~9
         13      > JMPZ                                                         ~10, ->16
         14    >   FE_FREE                                                      $8
         15      > RETURN                                                       <true>
   15    16    > > JMP                                                          ->9
         17    >   FE_FREE                                                      $8
   18    18      > RETURN                                                       <false>
   19    19*     > RETURN                                                       null

End of function strposa

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
163.48 ms | 2248 KiB | 15 Q