3v4l.org

run code in 500+ PHP versions simultaneously
<?php //file testWorks.php interface IStringable1 { public function toString(); } class MyTestWorks1 implements IStringable1 { public function toString($a = '', $b = NULL) { echo "My Test is instantiated", PHP_EOL; } } $obj = new MyTestWorks1(); $obj->toString(); //file testBroken.php interface IStringable2 { public function toString(); } trait TStringable2 { public function toString($a = '', $b = NULL) { echo "My Test is instantiated", PHP_EOL; } } class MyTestWorks2 implements IStringable2{ use TStringable2; } $obj = new MyTestWorks2(); $obj->toString();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/42bbB
function name:  (null)
number of ops:  13
compiled vars:  !0 = $obj
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   DECLARE_CLASS                                                'mytestworks1'
   12     1        NEW                                                  $1      'MyTestWorks1'
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !0, $1
   13     4        INIT_METHOD_CALL                                             !0, 'toString'
          5        DO_FCALL                                          0          
   26     6        DECLARE_CLASS                                                'mytestworks2'
   29     7        NEW                                                  $5      'MyTestWorks2'
          8        DO_FCALL                                          0          
          9        ASSIGN                                                       !0, $5
   30    10        INIT_METHOD_CALL                                             !0, 'toString'
         11        DO_FCALL                                          0          
         12      > RETURN                                                       1

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

End of function tostring

End of class IStringable1.

Class MyTestWorks1:
Function tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/42bbB
function name:  toString
number of ops:  5
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    8     0  E >   RECV_INIT                                            !0      ''
          1        RECV_INIT                                            !1      null
    9     2        ECHO                                                         'My+Test+is+instantiated'
          3        ECHO                                                         '%0A'
   10     4      > RETURN                                                       null

End of function tostring

End of class MyTestWorks1.

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

End of function tostring

End of class IStringable2.

Class TStringable2:
Function tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/42bbB
function name:  toString
number of ops:  5
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   22     0  E >   RECV_INIT                                            !0      ''
          1        RECV_INIT                                            !1      null
   23     2        ECHO                                                         'My+Test+is+instantiated'
          3        ECHO                                                         '%0A'
   24     4      > RETURN                                                       null

End of function tostring

End of class TStringable2.

Class MyTestWorks2: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
163.25 ms | 2691 KiB | 13 Q