3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { static public function bar() { return __CLASS__; } public function get_cb() { return array( get_class( $this ), 'bar' ); } } class Other extends Foo { static public function bar() { return 'TooGood'; } } $o1 = new Foo(); $o2 = new Other(); var_dump( call_user_func( $o1->get_cb() ) ); var_dump( call_user_func( $o2->get_cb() ) ); var_dump( $o1->bar() );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cCSCq
function name:  (null)
number of ops:  26
compiled vars:  !0 = $o1, !1 = $o2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   NEW                                              $2      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   22     3        NEW                                              $5      'Other'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $5
   24     6        INIT_FCALL                                               'var_dump'
          7        INIT_METHOD_CALL                                         !0, 'get_cb'
          8        DO_FCALL                                      0  $8      
          9        INIT_USER_CALL                                0          'call_user_func', $8
         10        DO_FCALL                                      0  $9      
         11        SEND_VAR                                                 $9
         12        DO_ICALL                                                 
   25    13        INIT_FCALL                                               'var_dump'
         14        INIT_METHOD_CALL                                         !1, 'get_cb'
         15        DO_FCALL                                      0  $11     
         16        INIT_USER_CALL                                0          'call_user_func', $11
         17        DO_FCALL                                      0  $12     
         18        SEND_VAR                                                 $12
         19        DO_ICALL                                                 
   27    20        INIT_FCALL                                               'var_dump'
         21        INIT_METHOD_CALL                                         !0, 'bar'
         22        DO_FCALL                                      0  $14     
         23        SEND_VAR                                                 $14
         24        DO_ICALL                                                 
         25      > RETURN                                                   1

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

End of function bar

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

End of function get_cb

End of class Foo.

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

End of function bar

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

End of function get_cb

End of class Other.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.5 ms | 1400 KiB | 15 Q