3v4l.org

run code in 300+ PHP versions simultaneously
<?php function &get_ref($_): string { static $a = "f"; return $a; } function &get_ref2(): string { $c = get_ref(...); return $c("foo"); } echo get_ref2();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Ojaah
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   INIT_FCALL                                               'get_ref2'
          1        DO_FCALL                                      0  $0      
          2        ECHO                                                     $0
          3      > RETURN                                                   1

Function get_ref:
Finding entry points
Branch analysis from position: 0
Return found
filename:       /in/Ojaah
function name:  get_ref
number of ops:  6
compiled vars:  !0 = $_, !1 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        BIND_STATIC                                              !1
    6     2        VERIFY_RETURN_TYPE                                       !1
          3      > RETURN_BY_REF                                            !1
    7     4*       VERIFY_RETURN_TYPE                                       
          5*     > RETURN_BY_REF                                            null

End of function get_ref

Function get_ref2:
Finding entry points
Branch analysis from position: 0
Return found
filename:       /in/Ojaah
function name:  get_ref2
number of ops:  10
compiled vars:  !0 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INIT_FCALL                                               'get_ref'
          1        ZEND_CALLABLE_CONVERT                            ~1      
          2        ASSIGN                                                   !0, ~1
   13     3        INIT_DYNAMIC_CALL                                        !0
          4        SEND_VAL_EX                                              'foo'
          5        DO_FCALL                                      0  $3      
          6        VERIFY_RETURN_TYPE                                       $3
          7      > RETURN_BY_REF                                            $3
   14     8*       VERIFY_RETURN_TYPE                                       
          9*     > RETURN_BY_REF                                            null

End of function get_ref2

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.57 ms | 1011 KiB | 15 Q