3v4l.org

run code in 300+ PHP versions simultaneously
<?php function anyKeyExists($haystack, $needles) { foreach ($needles as $needle) { if (isset($haystack[$needle])) { return true; } } return false; } $array = [ "keyA" => 1, "keyB" => 2, "keyC" => 3 ]; echo "noMatch: " , (int)anyKeyExists($array, ['keyD', 'keyF']) , "\n"; echo "oneMatch: " , anyKeyExists($array, ['keyB', 'keyD']) , "\n"; echo "twoMatches: " , anyKeyExists($array, ['keyA', 'keyC']) , "\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UG6nt
function name:  (null)
number of ops:  24
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   ASSIGN                                                   !0, <array>
   17     1        ECHO                                                     'noMatch%3A+'
          2        INIT_FCALL                                               'anykeyexists'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 <array>
          5        DO_FCALL                                      0  $2      
          6        CAST                                          4  ~3      $2
          7        ECHO                                                     ~3
          8        ECHO                                                     '%0A'
   18     9        ECHO                                                     'oneMatch%3A+'
         10        INIT_FCALL                                               'anykeyexists'
         11        SEND_VAR                                                 !0
         12        SEND_VAL                                                 <array>
         13        DO_FCALL                                      0  $4      
         14        ECHO                                                     $4
         15        ECHO                                                     '%0A'
   19    16        ECHO                                                     'twoMatches%3A+'
         17        INIT_FCALL                                               'anykeyexists'
         18        SEND_VAR                                                 !0
         19        SEND_VAL                                                 <array>
         20        DO_FCALL                                      0  $5      
         21        ECHO                                                     $5
         22        ECHO                                                     '%0A'
         23      > RETURN                                                   1

Function anykeyexists:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 9
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 9
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/UG6nt
function name:  anyKeyExists
number of ops:  12
compiled vars:  !0 = $haystack, !1 = $needles, !2 = $needle
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    3     2      > FE_RESET_R                                       $3      !1, ->9
          3    > > FE_FETCH_R                                               $3, !2, ->9
    4     4    >   ISSET_ISEMPTY_DIM_OBJ                         0          !0, !2
          5      > JMPZ                                                     ~4, ->8
    5     6    >   FE_FREE                                                  $3
          7      > RETURN                                                   <true>
    3     8    > > JMP                                                      ->3
          9    >   FE_FREE                                                  $3
    8    10      > RETURN                                                   <false>
    9    11*     > RETURN                                                   null

End of function anykeyexists

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
223.69 ms | 1003 KiB | 16 Q