3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace hippos; trait test { public static function getClassName() { return 'hi hippo'; } } namespace lions; trait test { public static function getClassName() { return 'hi giraffe'; } } namespace girrafe; use lions\test; use hippos\test as hipposTest; class lemons { use hipposTest, test { test::getClassName as myGetClassName; } public function sup() { var_dump(method_exists('lemons', 'getClassName')); var_dump(method_exists(get_class(), 'getClassName')); var_dump(method_exists(get_class(), 'myGetClassName')); echo $this->getClassName(); echo $this->myGetClassName(); } } (new \girrafe\lemons)->sup();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VpMGs
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   DECLARE_CLASS                                            'girrafe%5Clemons'
   37     1        NEW                                              $0      'girrafe%5Clemons'
          2        DO_FCALL                                      0          
          3        INIT_METHOD_CALL                                         $0, 'sup'
          4        DO_FCALL                                      0          
          5      > RETURN                                                   1

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

End of function getclassname

End of class hippos\test.

Class lions\test:
Function getclassname:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VpMGs
function name:  getClassName
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E > > RETURN                                                   'hi+giraffe'
   15     1*     > RETURN                                                   null

End of function getclassname

End of class lions\test.

Class girrafe\lemons:
Function sup:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VpMGs
function name:  sup
number of ops:  32
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   INIT_NS_FCALL_BY_NAME                                    'girrafe%5Cvar_dump'
          1        INIT_NS_FCALL_BY_NAME                                    'girrafe%5Cmethod_exists'
          2        SEND_VAL_EX                                              'lemons'
          3        SEND_VAL_EX                                              'getClassName'
          4        DO_FCALL                                      0  $0      
          5        SEND_VAR_NO_REF_EX                                       $0
          6        DO_FCALL                                      0          
   30     7        INIT_NS_FCALL_BY_NAME                                    'girrafe%5Cvar_dump'
          8        INIT_NS_FCALL_BY_NAME                                    'girrafe%5Cmethod_exists'
          9        INIT_NS_FCALL_BY_NAME                                    'girrafe%5Cget_class'
         10        DO_FCALL                                      0  $2      
         11        SEND_VAR_NO_REF_EX                                       $2
         12        SEND_VAL_EX                                              'getClassName'
         13        DO_FCALL                                      0  $3      
         14        SEND_VAR_NO_REF_EX                                       $3
         15        DO_FCALL                                      0          
   31    16        INIT_NS_FCALL_BY_NAME                                    'girrafe%5Cvar_dump'
         17        INIT_NS_FCALL_BY_NAME                                    'girrafe%5Cmethod_exists'
         18        INIT_NS_FCALL_BY_NAME                                    'girrafe%5Cget_class'
         19        DO_FCALL                                      0  $5      
         20        SEND_VAR_NO_REF_EX                                       $5
         21        SEND_VAL_EX                                              'myGetClassName'
         22        DO_FCALL                                      0  $6      
         23        SEND_VAR_NO_REF_EX                                       $6
         24        DO_FCALL                                      0          
   32    25        INIT_METHOD_CALL                                         'getClassName'
         26        DO_FCALL                                      0  $8      
         27        ECHO                                                     $8
   33    28        INIT_METHOD_CALL                                         'myGetClassName'
         29        DO_FCALL                                      0  $9      
         30        ECHO                                                     $9
   34    31      > RETURN                                                   null

End of function sup

End of class girrafe\lemons.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
199 ms | 1400 KiB | 19 Q