3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Foo; trait aTrait { protected function one() { echo "a-one "; } public function two() { echo "a-two "; } public function three() { return defined('static::DELETED_AT') ? static::DELETED_AT : 'deleted_at'; } } namespace Bar; use Foo\aTrait as bTrait; trait aTrait { use bTrait { one as originalOne; two as originalGetQualifiedDeletedAtColumn; } protected function one() { echo "b-one"; $this->originalOne(); } public function two() { if (true) { return $this->three(); } $this->originalGetQualifiedDeletedAtColumn(); } } namespace Baz; use Bar\atrait; class Base { use aTrait; const DELETED_AT = 'DELETETIMESTAMP'; } class Test extends Base { public function __construct() { $this->one(); } } $test = new Test();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/q7Icb
function name:  (null)
number of ops:  7
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   DECLARE_CLASS                                            'bar%5Catrait'
   49     1        DECLARE_CLASS                                            'baz%5Cbase'
   55     2        DECLARE_CLASS                                            'baz%5Ctest', 'baz%5Cbase'
   62     3        NEW                                              $1      'Baz%5CTest'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $1
          6      > RETURN                                                   1

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

End of function one

Function two:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/q7Icb
function name:  two
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   ECHO                                                     'a-two+'
   12     1      > RETURN                                                   null

End of function two

Function three:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/q7Icb
function name:  three
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   INIT_NS_FCALL_BY_NAME                                    'Foo%5Cdefined'
          1        SEND_VAL_EX                                              'static%3A%3ADELETED_AT'
          2        DO_FCALL                                      0  $0      
          3      > JMPZ                                                     $0, ->7
          4    >   FETCH_CLASS_CONSTANT                             ~1      'DELETED_AT'
          5        QM_ASSIGN                                        ~2      ~1
          6      > JMP                                                      ->8
          7    >   QM_ASSIGN                                        ~2      'deleted_at'
          8    > > RETURN                                                   ~2
   17     9*     > RETURN                                                   null

End of function three

End of class Foo\aTrait.

Class Bar\aTrait:
Function one:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/q7Icb
function name:  one
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   ECHO                                                     'b-one'
   33     1        INIT_METHOD_CALL                                         'originalOne'
          2        DO_FCALL                                      0          
   34     3      > RETURN                                                   null

End of function one

Function two:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 1, Position 2 = 4
Branch analysis from position: 1
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/q7Icb
function name:  two
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   37     0  E > > JMPZ                                                     <true>, ->4
   38     1    >   INIT_METHOD_CALL                                         'three'
          2        DO_FCALL                                      0  $0      
          3      > RETURN                                                   $0
   41     4    >   INIT_METHOD_CALL                                         'originalGetQualifiedDeletedAtColumn'
          5        DO_FCALL                                      0          
   42     6      > RETURN                                                   null

End of function two

End of class Bar\aTrait.

Class Baz\Base: [no user functions]
Class Baz\Test:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/q7Icb
function name:  __construct
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   58     0  E >   INIT_METHOD_CALL                                         'one'
          1        DO_FCALL                                      0          
   59     2      > RETURN                                                   null

End of function __construct

End of class Baz\Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.88 ms | 1400 KiB | 15 Q