3v4l.org

run code in 500+ PHP versions simultaneously
<?php class C { private function f() { echo "hello"; } public function fn(): callable { return [$this, 'f']; } } $c = new C(); $f = $c->fn(); $f();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hCpiG
function name:  (null)
number of ops:  9
compiled vars:  !0 = $c, !1 = $f
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    8     0  E >   NEW                                                  $2      'C'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $2
    9     3        INIT_METHOD_CALL                                             !0, 'fn'
          4        DO_FCALL                                          0  $5      
          5        ASSIGN                                                       !1, $5
   10     6        INIT_DYNAMIC_CALL                                            !1
          7        DO_FCALL                                          0          
          8      > RETURN                                                       1

Class C:
Function f:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hCpiG
function name:  f
number of ops:  2
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   ECHO                                                         'hello'
          1      > RETURN                                                       null

End of function f

Function fn:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hCpiG
function name:  fn
number of ops:  7
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   FETCH_THIS                                           ~0      
          1        INIT_ARRAY                                           ~1      ~0
          2        ADD_ARRAY_ELEMENT                                    ~1      'f'
          3        VERIFY_RETURN_TYPE                                           ~1
          4      > RETURN                                                       ~1
          5*       VERIFY_RETURN_TYPE                                           
          6*     > RETURN                                                       null

End of function fn

End of class C.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
162.95 ms | 1386 KiB | 13 Q