3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace { const HELLO_WORLD = "Hello World"; trait TraitParent { public static $staticvar = HELLO_WORLD; public static function test() { return self::$staticvar; } } trait TraitChild { use TraitParent; } Class ClassWhitChildTrait { use TraitChild; } Class ClassWhitOverideChildTrait extends ClassWhitChildTrait { use TraitParent; } echo ClassWhitChildTrait::test() . PHP_EOL; echo ClassWhitOverideChildTrait::test(); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fSRan
function name:  (null)
number of ops:  12
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   DECLARE_CONST                                            'HELLO_WORLD', 'Hello+World'
   16     1        DECLARE_CLASS                                            'traitchild'
   21     2        DECLARE_CLASS                                            'classwhitchildtrait'
   26     3        DECLARE_CLASS                                            'classwhitoveridechildtrait', 'classwhitchildtrait'
   31     4        INIT_STATIC_METHOD_CALL                                  'ClassWhitChildTrait', 'test'
          5        DO_FCALL                                      0  $0      
          6        CONCAT                                           ~1      $0, '%0A'
          7        ECHO                                                     ~1
   32     8        INIT_STATIC_METHOD_CALL                                  'ClassWhitOverideChildTrait', 'test'
          9        DO_FCALL                                      0  $2      
         10        ECHO                                                     $2
   33    11      > RETURN                                                   1

Class TraitParent:
Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fSRan
function name:  test
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   FETCH_STATIC_PROP_R          unknown             ~0      'staticvar'
          1      > RETURN                                                   ~0
   12     2*     > RETURN                                                   null

End of function test

End of class TraitParent.

Class TraitChild: [no user functions]
Class ClassWhitChildTrait: [no user functions]
Class ClassWhitOverideChildTrait: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.72 ms | 1393 KiB | 13 Q