3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test(array $input1, array $input2): bool { $result = array_intersect($input1,$input2); $result = count($result) > 0; return $result; } $expected = false; var_dump(test([1,2,3],[4,7]) === $expected); // works? $expected = true; var_dump(test([1,2,3],[1,2]) === $expected); // works?
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YfhC6
function name:  (null)
number of ops:  19
compiled vars:  !0 = $expected
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   ASSIGN                                                   !0, <false>
   11     1        INIT_FCALL                                               'var_dump'
          2        INIT_FCALL                                               'test'
          3        SEND_VAL                                                 <array>
          4        SEND_VAL                                                 <array>
          5        DO_FCALL                                      0  $2      
          6        IS_IDENTICAL                                     ~3      !0, $2
          7        SEND_VAL                                                 ~3
          8        DO_ICALL                                                 
   13     9        ASSIGN                                                   !0, <true>
   14    10        INIT_FCALL                                               'var_dump'
         11        INIT_FCALL                                               'test'
         12        SEND_VAL                                                 <array>
         13        SEND_VAL                                                 <array>
         14        DO_FCALL                                      0  $6      
         15        IS_IDENTICAL                                     ~7      !0, $6
         16        SEND_VAL                                                 ~7
         17        DO_ICALL                                                 
         18      > RETURN                                                   1

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YfhC6
function name:  test
number of ops:  14
compiled vars:  !0 = $input1, !1 = $input2, !2 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        INIT_FCALL                                               'array_intersect'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $3      
          6        ASSIGN                                                   !2, $3
    5     7        COUNT                                            ~5      !2
          8        IS_SMALLER                                       ~6      0, ~5
          9        ASSIGN                                                   !2, ~6
    7    10        VERIFY_RETURN_TYPE                                       !2
         11      > RETURN                                                   !2
    8    12*       VERIFY_RETURN_TYPE                                       
         13*     > RETURN                                                   null

End of function test

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.9 ms | 1004 KiB | 17 Q