3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public static $c = 100; public static function &D() { return self::$c; } } echo A::$c; //prints 100 $cRef1 =& A::D(); $cRef1 = 200; echo A::$c; //prints 200 $a = new ReflectionClass('A'); $d = $a->getMethod('D'); $cRef2 =& $d->invoke(null); //DOES NOT RETURN REFERENCE!!! $cRef2 = 300; echo A::$c; //prints 200
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NJBRv
function name:  (null)
number of ops:  24
compiled vars:  !0 = $cRef1, !1 = $a, !2 = $d, !3 = $cRef2
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  11     0  E >   FETCH_STATIC_PROP_R          unknown             ~4      'c'
         1        ASSIGN_OBJ                                               ~4
  12     2        INIT_STATIC_METHOD_CALL                                  'A', 'D'
         3        DO_FCALL                                      0  $5      
         4        ASSIGN_CONCAT                                 1          !0, $5
  13     5        QM_ASSIGN                                                !0
  14     6        FETCH_STATIC_PROP_R          unknown             ~8      'c'
         7        ASSIGN_OBJ                                               ~8
  15     8        NEW                                              $9      :38
         9        SEND_VAL_EX                                              'A'
        10        DO_FCALL                                      0          
        11        QM_ASSIGN                                                !1
  16    12        INIT_METHOD_CALL                                         !1, 'getMethod'
        13        SEND_VAL_EX                                              'D'
        14        DO_FCALL                                      0  $12     
        15        QM_ASSIGN                                                !2
  17    16        INIT_METHOD_CALL                                         !2, 'invoke'
        17        SEND_VAL_EX                                              null
        18        DO_FCALL                                      0  $14     
        19        ASSIGN_CONCAT                                 1          !3, $14
  18    20        QM_ASSIGN                                                !3
  19    21        FETCH_STATIC_PROP_R          unknown             ~17     'c'
        22        ASSIGN_OBJ                                               ~17
        23      > RETURN                                                   1

Class A:
Function d:
Finding entry points
Branch analysis from position: 0
Return found
filename:       /in/NJBRv
function name:  D
number of ops:  3
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   7     0  E >   FETCH_STATIC_PROP_W          unknown             $0      'c'
         1      > RETURN_BY_REF                                            $0
   8     2*     > RETURN_BY_REF                                            null

End of function d

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
14.42 ms | 411 KiB | 7 Q