3v4l.org

run code in 300+ PHP versions simultaneously
<?php function strInArray($haystack, $needle) { $i = 0; foreach ($haystack as $value) { $result = stripos($value,$needle); if ($result !== FALSE) return TRUE; $i++; } return FALSE; } $array = array(12,43,66,21,56,43,43,78,78,100,43,43,43,21); for ($i = 0; $i < count($array); $i++) { if (strInArray($array,$array[$i])) { unset($array[$i]); } } var_dump($array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 3
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 10
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 3
Branch analysis from position: 14
Branch analysis from position: 3
Branch analysis from position: 10
filename:       /in/XqgDA
function name:  (null)
number of ops:  18
compiled vars:  !0 = $array, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   ASSIGN                                                   !0, <array>
   15     1        ASSIGN                                                   !1, 0
          2      > JMP                                                      ->11
   16     3    >   INIT_FCALL                                               'strinarray'
          4        SEND_VAR                                                 !0
          5        FETCH_DIM_R                                      ~4      !0, !1
          6        SEND_VAL                                                 ~4
          7        DO_FCALL                                      0  $5      
          8      > JMPZ                                                     $5, ->10
   17     9    >   UNSET_DIM                                                !0, !1
   15    10    >   PRE_INC                                                  !1
         11    >   COUNT                                            ~7      !0
         12        IS_SMALLER                                               !1, ~7
         13      > JMPNZ                                                    ~8, ->3
   20    14    >   INIT_FCALL                                               'var_dump'
         15        SEND_VAR                                                 !0
         16        DO_ICALL                                                 
         17      > RETURN                                                   1

Function strinarray:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 16
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 16
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 14
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/XqgDA
function name:  strInArray
number of ops:  19
compiled vars:  !0 = $haystack, !1 = $needle, !2 = $i, !3 = $value, !4 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        ASSIGN                                                   !2, 0
    5     3      > FE_RESET_R                                       $6      !0, ->16
          4    > > FE_FETCH_R                                               $6, !3, ->16
    6     5    >   INIT_FCALL                                               'stripos'
          6        SEND_VAR                                                 !3
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                         $7      
          9        ASSIGN                                                   !4, $7
    7    10        TYPE_CHECK                                  1018          !4
         11      > JMPZ                                                     ~9, ->14
         12    >   FE_FREE                                                  $6
         13      > RETURN                                                   <true>
    8    14    >   PRE_INC                                                  !2
    5    15      > JMP                                                      ->4
         16    >   FE_FREE                                                  $6
   10    17      > RETURN                                                   <false>
   11    18*     > RETURN                                                   null

End of function strinarray

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.04 ms | 1407 KiB | 18 Q