3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { /** @var int */ public static $bar = 0; public ?string $test = null; /** @psalm-external-mutation-free */ public function setTest(string $value) : void { $this->test = $value; ++self::$bar; } } class Bar { /** @psalm-mutation-free */ function test() : void { $foo = new Foo(); $foo->setTest('abcd'); } } $bar = new Bar(); $a = Foo::$bar; /** @psalm-suppress UnusedMethodCall irrelevant */ $bar->test(); $b = Foo::$bar; assert($a === $b);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TnqrJ
function name:  (null)
number of ops:  16
compiled vars:  !0 = $bar, !1 = $a, !2 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   NEW                                              $3      'Bar'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
   29     3        FETCH_STATIC_PROP_R          global lock         ~6      'bar'
          4        ASSIGN                                                   !1, ~6
   31     5        INIT_METHOD_CALL                                         !0, 'test'
          6        DO_FCALL                                      0          
   32     7        FETCH_STATIC_PROP_R          unknown             ~9      'bar'
          8        ASSIGN                                                   !2, ~9
   33     9        ASSERT_CHECK                                             
         10        INIT_FCALL                                               'assert'
         11        IS_IDENTICAL                                     ~11     !1, !2
         12        SEND_VAL                                                 ~11
         13        SEND_VAL                                                 'assert%28%24a+%3D%3D%3D+%24b%29'
         14        DO_ICALL                                                 
         15      > RETURN                                                   1

Class Foo:
Function settest:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TnqrJ
function name:  setTest
number of ops:  5
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   13     1        ASSIGN_OBJ                                               'test'
          2        OP_DATA                                                  !0
   14     3        PRE_INC_STATIC_PROP                                      'bar'
   15     4      > RETURN                                                   null

End of function settest

End of class Foo.

Class Bar:
Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TnqrJ
function name:  test
number of ops:  7
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   NEW                                              $1      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   24     3        INIT_METHOD_CALL                                         !0, 'setTest'
          4        SEND_VAL_EX                                              'abcd'
          5        DO_FCALL                                      0          
   25     6      > RETURN                                                   null

End of function test

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
270.31 ms | 1011 KiB | 14 Q