3v4l.org

run code in 500+ PHP versions simultaneously
<?php $haystack = array( "id" => 1, "char1" => 2, "char2" => 3, "char3" => 4, ); $needles = array(2, 4); function in_array_any($needles, $haystack) { unset($haystack['id']); return !array_diff($needles, $haystack); } $exists = in_array_any([2, 4], $haystack); // true var_dump($exists); $exists = in_array_any([1, 3], $haystack); // true var_dump($exists);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PTjOS
function name:  (null)
number of ops:  19
compiled vars:  !0 = $haystack, !1 = $needles, !2 = $exists
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   10     1        ASSIGN                                                       !1, <array>
   16     2        INIT_FCALL                                                   'in_array_any'
          3        SEND_VAL                                                     <array>
          4        SEND_VAR                                                     !0
          5        DO_FCALL                                          0  $5      
          6        ASSIGN                                                       !2, $5
   17     7        INIT_FCALL                                                   'var_dump'
          8        SEND_VAR                                                     !2
          9        DO_ICALL                                                     
   18    10        INIT_FCALL                                                   'in_array_any'
         11        SEND_VAL                                                     <array>
         12        SEND_VAR                                                     !0
         13        DO_FCALL                                          0  $8      
         14        ASSIGN                                                       !2, $8
   19    15        INIT_FCALL                                                   'var_dump'
         16        SEND_VAR                                                     !2
         17        DO_ICALL                                                     
         18      > RETURN                                                       1

Function in_array_any:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PTjOS
function name:  in_array_any
number of ops:  10
compiled vars:  !0 = $needles, !1 = $haystack
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   12     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   13     2        UNSET_DIM                                                    !1, 'id'
   14     3        INIT_FCALL                                                   'array_diff'
          4        SEND_VAR                                                     !0
          5        SEND_VAR                                                     !1
          6        DO_ICALL                                             $2      
          7        BOOL_NOT                                             ~3      $2
          8      > RETURN                                                       ~3
   15     9*     > RETURN                                                       null

End of function in_array_any

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
138.87 ms | 1856 KiB | 17 Q