3v4l.org

run code in 500+ PHP versions simultaneously
<?php $a = array(3,4); $b =& $a; $c =& $a; var_dump( is_same_ref( $a, $b )); $a[] = 5; $b[] = 6; var_dump( implode( $a ), implode( $b ), implode( $c )); function is_same_ref( & $a, & $b ){ // Save original values $ori_a = $a; $ori_b = $b; // Give them different values $a = 1; $b = 2; // Compare them, if they're equal, they are references to each other $eq = $a === $b; // Restore original values $a = $ori_a; $b = $ori_b; return $eq; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5JNSl
function name:  (null)
number of ops:  23
compiled vars:  !0 = $a, !1 = $b, !2 = $c
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
    4     1        ASSIGN_REF                                                   !1, !0
    5     2        ASSIGN_REF                                                   !2, !0
    6     3        INIT_FCALL                                                   'var_dump'
          4        INIT_FCALL_BY_NAME                                           'is_same_ref'
          5        SEND_VAR_EX                                                  !0
          6        SEND_VAR_EX                                                  !1
          7        DO_FCALL                                          0  $6      
          8        SEND_VAR                                                     $6
          9        DO_ICALL                                                     
    7    10        ASSIGN_DIM                                                   !0
         11        OP_DATA                                                      5
    8    12        ASSIGN_DIM                                                   !1
         13        OP_DATA                                                      6
    9    14        INIT_FCALL                                                   'var_dump'
         15        FRAMELESS_ICALL_1                implode             ~10     !0
         16        SEND_VAL                                                     ~10
         17        FRAMELESS_ICALL_1                implode             ~11     !1
         18        SEND_VAL                                                     ~11
         19        FRAMELESS_ICALL_1                implode             ~12     !2
         20        SEND_VAL                                                     ~12
         21        DO_ICALL                                                     
   24    22      > RETURN                                                       1

Function is_same_ref:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5JNSl
function name:  is_same_ref
number of ops:  12
compiled vars:  !0 = $a, !1 = $b, !2 = $ori_a, !3 = $ori_b, !4 = $eq
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   11     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   13     2        ASSIGN                                                       !2, !0
   14     3        ASSIGN                                                       !3, !1
   16     4        ASSIGN                                                       !0, 1
   17     5        ASSIGN                                                       !1, 2
   19     6        IS_IDENTICAL                                         ~9      !0, !1
          7        ASSIGN                                                       !4, ~9
   21     8        ASSIGN                                                       !0, !2
   22     9        ASSIGN                                                       !1, !3
   23    10      > RETURN                                                       !4
   24    11*     > RETURN                                                       null

End of function is_same_ref

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
164.47 ms | 3334 KiB | 14 Q