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_all($needles, $haystack) { unset($haystack['id']); return empty(array_diff($needles, $haystack)); } $exists = in_array_all([2, 4], $haystack); // true var_dump($exists); $exists = in_array_all([1, 3], $haystack); // true var_dump($exists); print_r($haystack);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CDDcf
function name:  (null)
number of ops:  22
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_all'
          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_all'
         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                                                     
   21    18        INIT_FCALL                                                   'print_r'
         19        SEND_VAR                                                     !0
         20        DO_ICALL                                                     
         21      > RETURN                                                       1

Function in_array_all:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CDDcf
function name:  in_array_all
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_all

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
195.2 ms | 1901 KiB | 18 Q