3v4l.org

run code in 300+ PHP versions simultaneously
<?php class foo { static public function instance () { echo 'hi'; return new self(); } } $method = 'foo'; var_dump( call_user_func( $method . '::instance' ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5a39b
function name:  (null)
number of ops:  8
compiled vars:  !0 = $method
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ASSIGN                                                   !0, 'foo'
    9     1        INIT_FCALL                                               'var_dump'
          2        CONCAT                                           ~2      !0, '%3A%3Ainstance'
          3        INIT_USER_CALL                                0          'call_user_func', ~2
          4        DO_FCALL                                      0  $3      
          5        SEND_VAR                                                 $3
          6        DO_ICALL                                                 
          7      > RETURN                                                   1

Class foo:
Function instance:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5a39b
function name:  instance
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ECHO                                                     'hi'
    5     1        NEW                          self                $0      
          2        DO_FCALL                                      0          
          3      > RETURN                                                   $0
    6     4*     > RETURN                                                   null

End of function instance

End of class foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.87 ms | 1386 KiB | 15 Q