3v4l.org

run code in 300+ 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:  29
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        INIT_FCALL                                               'implode'
         16        SEND_VAR                                                 !0
         17        DO_ICALL                                         $10     
         18        SEND_VAR                                                 $10
         19        INIT_FCALL                                               'implode'
         20        SEND_VAR                                                 !1
         21        DO_ICALL                                         $11     
         22        SEND_VAR                                                 $11
         23        INIT_FCALL                                               'implode'
         24        SEND_VAR                                                 !2
         25        DO_ICALL                                         $12     
         26        SEND_VAR                                                 $12
         27        DO_ICALL                                                 
   24    28      > 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.0.0


preferences:
140.75 ms | 1405 KiB | 17 Q