3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace One; abstract class Abs { public function __toString() { return strtolower(get_called_class()); /* Should print test, not abs :P */ } } namespace Two; class Test extends One\Abs { } $x = new Two\Test; echo $x;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/43NqJ
function name:  (null)
number of ops:  7
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   DECLARE_CLASS                                            'one%5Cabs'
   14     1        DECLARE_CLASS                                            'two%5Ctest', 'two%5Cone%5Cabs'
   18     2        NEW                                              $1      'Two%5CTwo%5CTest'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $1
   19     5        ECHO                                                     !0
          6      > RETURN                                                   1

Class One\Abs:
Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/43NqJ
function name:  __toString
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   INIT_NS_FCALL_BY_NAME                                    'One%5Cstrtolower'
          1        INIT_NS_FCALL_BY_NAME                                    'One%5Cget_called_class'
          2        DO_FCALL                                      0  $0      
          3        SEND_VAR_NO_REF_EX                                       $0
          4        DO_FCALL                                      0  $1      
          5        VERIFY_RETURN_TYPE                                       $1
          6      > RETURN                                                   $1
    9     7*       VERIFY_RETURN_TYPE                                       
          8*     > RETURN                                                   null

End of function __tostring

End of class One\Abs.

Class Two\Test: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.33 ms | 1386 KiB | 17 Q