3v4l.org

run code in 500+ PHP versions simultaneously
<?php $a = Array ( 'user_id' => 10, 'id' => 2, 'user' => 'Nakiya', ); $b = Array ( 'user_id' => 10, 'id' => 7, 'user' => 'Nakiya', ); /** * Return an array with all elements found in both input arrays. */ function intersection($a, $b) { $a = (array) $a; $b = (array) $b; return array_values(array_intersect($a, $b)); } $arr =intersection($a, $b); print_r($arr);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/W4Zai
function name:  (null)
number of ops:  11
compiled vars:  !0 = $a, !1 = $b, !2 = $arr
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   10     1        ASSIGN                                                       !1, <array>
   28     2        INIT_FCALL                                                   'intersection'
          3        SEND_VAR                                                     !0
          4        SEND_VAR                                                     !1
          5        DO_FCALL                                          0  $5      
          6        ASSIGN                                                       !2, $5
   30     7        INIT_FCALL                                                   'print_r'
          8        SEND_VAR                                                     !2
          9        DO_ICALL                                                     
         10      > RETURN                                                       1

Function intersection:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/W4Zai
function name:  intersection
number of ops:  15
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   20     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   22     2        CAST                                              7  ~2      !0
          3        ASSIGN                                                       !0, ~2
   23     4        CAST                                              7  ~4      !1
          5        ASSIGN                                                       !1, ~4
   25     6        INIT_FCALL                                                   'array_values'
          7        INIT_FCALL                                                   'array_intersect'
          8        SEND_VAR                                                     !0
          9        SEND_VAR                                                     !1
         10        DO_ICALL                                             $6      
         11        SEND_VAR                                                     $6
         12        DO_ICALL                                             $7      
         13      > RETURN                                                       $7
   26    14*     > RETURN                                                       null

End of function intersection

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
186.15 ms | 2111 KiB | 17 Q