3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait foo { static $bar = []; public function a() { static::$bar = ["foo"]; echo "Goodbye Moon"; } } class bing { use foo; public function a() { foo::a(); var_dump(self::$bar, foo::$bar); } public function b() { foo::a(); self::$bar[] = "bat"; var_dump(self::$bar, foo::$bar); } } $bing = new bing; $bing->a(); $bing->b();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/piUFm
function name:  (null)
number of ops:  9
compiled vars:  !0 = $bing
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   DECLARE_CLASS                                            'bing'
   27     1        NEW                                              $1      'bing'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   28     4        INIT_METHOD_CALL                                         !0, 'a'
          5        DO_FCALL                                      0          
   29     6        INIT_METHOD_CALL                                         !0, 'b'
          7        DO_FCALL                                      0          
          8      > RETURN                                                   1

Class foo:
Function a:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/piUFm
function name:  a
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   ASSIGN_STATIC_PROP                                       'bar'
          1        OP_DATA                                                  <array>
    8     2        ECHO                                                     'Goodbye+Moon'
    9     3      > RETURN                                                   null

End of function a

End of class foo.

Class bing:
Function a:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/piUFm
function name:  a
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   INIT_STATIC_METHOD_CALL                                  'foo', 'a'
          1        DO_FCALL                                      0          
   17     2        INIT_FCALL                                               'var_dump'
          3        FETCH_STATIC_PROP_R          unknown             ~1      'bar'
          4        SEND_VAL                                                 ~1
          5        FETCH_STATIC_PROP_R          unknown             ~2      'bar'
          6        SEND_VAL                                                 ~2
          7        DO_ICALL                                                 
   18     8      > RETURN                                                   null

End of function a

Function b:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/piUFm
function name:  b
number of ops:  12
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   INIT_STATIC_METHOD_CALL                                  'foo', 'a'
          1        DO_FCALL                                      0          
   22     2        FETCH_STATIC_PROP_W          unknown             $1      'bar'
          3        ASSIGN_DIM                                               $1
          4        OP_DATA                                                  'bat'
   23     5        INIT_FCALL                                               'var_dump'
          6        FETCH_STATIC_PROP_R          unknown             ~3      'bar'
          7        SEND_VAL                                                 ~3
          8        FETCH_STATIC_PROP_R          unknown             ~4      'bar'
          9        SEND_VAL                                                 ~4
         10        DO_ICALL                                                 
   24    11      > RETURN                                                   null

End of function b

End of class bing.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.92 ms | 1003 KiB | 14 Q