3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Check if an array contains any value in a set. ** * @param array $array * @param array $subset * @param bool $strict Strict type checking * @return bool */ $a=array(1,'test'); $b=array(2,'test'); function array_contains_any_val(array $array, array $subset, bool $strict = false) :bool { $contains = false; foreach ($subset as $value) { if (in_array($value, $array, $strict)) { $contains = true; break; } } return $contains; } var_dump(array_contains_any_val($a, $b));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/J68Ih
function name:  (null)
number of ops:  10
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   ASSIGN                                                   !0, <array>
   11     1        ASSIGN                                                   !1, <array>
   25     2        INIT_FCALL                                               'var_dump'
          3        INIT_FCALL                                               'array_contains_any_val'
          4        SEND_VAR                                                 !0
          5        SEND_VAR                                                 !1
          6        DO_FCALL                                      0  $4      
          7        SEND_VAR                                                 $4
          8        DO_ICALL                                                 
          9      > RETURN                                                   1

Function array_contains_any_val:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 15
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 15
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 14
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 15
Branch analysis from position: 15
filename:       /in/J68Ih
function name:  array_contains_any_val
number of ops:  20
compiled vars:  !0 = $array, !1 = $subset, !2 = $strict, !3 = $contains, !4 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV_INIT                                        !2      <false>
   15     3        ASSIGN                                                   !3, <false>
   16     4      > FE_RESET_R                                       $6      !1, ->15
          5    > > FE_FETCH_R                                               $6, !4, ->15
   17     6    >   INIT_FCALL                                               'in_array'
          7        SEND_VAR                                                 !4
          8        SEND_VAR                                                 !0
          9        SEND_VAR                                                 !2
         10        DO_ICALL                                         $7      
         11      > JMPZ                                                     $7, ->14
   18    12    >   ASSIGN                                                   !3, <true>
   19    13      > JMP                                                      ->15
   16    14    > > JMP                                                      ->5
         15    >   FE_FREE                                                  $6
   22    16        VERIFY_RETURN_TYPE                                       !3
         17      > RETURN                                                   !3
   23    18*       VERIFY_RETURN_TYPE                                       
         19*     > RETURN                                                   null

End of function array_contains_any_val

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
210.67 ms | 959 KiB | 16 Q