3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = new StdClass(); $b = &$a; var_dump(is_ref($a, $b)); function is_ref(&$a, &$b) { // create a unique different value $differentValue = ($a === true) ? false : true; // We need a copy of $a, to keep safe. Note that if $a is a "referenced" value, $copy will be too. $copy = $a; // Change $a and check if $b changed too, finally restore $a using $copy. $a = $differentValue; $same = $a === $b; $a = $copy; return $same; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8Jbto
function name:  (null)
number of ops:  12
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                                              $2      'StdClass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
    4     3        ASSIGN_REF                                               !1, !0
    6     4        INIT_FCALL                                               'var_dump'
          5        INIT_FCALL_BY_NAME                                       'is_ref'
          6        SEND_VAR_EX                                              !0
          7        SEND_VAR_EX                                              !1
          8        DO_FCALL                                      0  $6      
          9        SEND_VAR                                                 $6
         10        DO_ICALL                                                 
   22    11      > RETURN                                                   1

Function is_ref:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8Jbto
function name:  is_ref
number of ops:  15
compiled vars:  !0 = $a, !1 = $b, !2 = $differentValue, !3 = $copy, !4 = $same
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   11     2        TYPE_CHECK                                    8          !0
          3      > JMPZ                                                     ~5, ->6
          4    >   QM_ASSIGN                                        ~6      <false>
          5      > JMP                                                      ->7
          6    >   QM_ASSIGN                                        ~6      <true>
          7    >   ASSIGN                                                   !2, ~6
   14     8        ASSIGN                                                   !3, !0
   17     9        ASSIGN                                                   !0, !2
   18    10        IS_IDENTICAL                                     ~10     !0, !1
         11        ASSIGN                                                   !4, ~10
   19    12        ASSIGN                                                   !0, !3
   21    13      > RETURN                                                   !4
   22    14*     > RETURN                                                   null

End of function is_ref

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
175.86 ms | 1396 KiB | 15 Q