3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait SampleTrait { /** * @var string */ private static $sample; final public static function setSample($sample) { self::$sample = $sample; } final public static function getSample() { return self::$sample; } } SampleTrait::setSample('test'); class SampleClass { use SampleTrait; } $sample = new SampleClass(); var_dump($sample::getSample());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GoUUr
function name:  (null)
number of ops:  14
compiled vars:  !0 = $sample
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   INIT_STATIC_METHOD_CALL                                  'SampleTrait', 'setSample'
          1        SEND_VAL                                                 'test'
          2        DO_FCALL                                      0          
   23     3        DECLARE_CLASS                                            'sampleclass'
   28     4        NEW                                              $2      'SampleClass'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !0, $2
   29     7        INIT_FCALL                                               'var_dump'
          8        FETCH_CLASS                                   0  $5      !0
          9        INIT_STATIC_METHOD_CALL                                  $5, 'getSample'
         10        DO_FCALL                                      0  $6      
         11        SEND_VAR                                                 $6
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

Class SampleTrait:
Function setsample:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GoUUr
function name:  setSample
number of ops:  4
compiled vars:  !0 = $sample
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   12     1        ASSIGN_STATIC_PROP                                       'sample'
          2        OP_DATA                                                  !0
   13     3      > RETURN                                                   null

End of function setsample

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

End of function getsample

End of class SampleTrait.

Class SampleClass: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.81 ms | 1395 KiB | 15 Q