3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public $test = 12; public function changeTest() { $this->test = 42; return $this; } } $test = new Test; $secondTest = (new Test)->changeTest(); $newtest = (clone $test)->changeTest(); var_dump($test); var_dump($secondTest);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lX6TT
function name:  (null)
number of ops:  19
compiled vars:  !0 = $test, !1 = $secondTest, !2 = $newtest
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   NEW                                              $3      'Test'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
    6     3        NEW                                              $6      'Test'
          4        DO_FCALL                                      0          
          5        INIT_METHOD_CALL                                         $6, 'changeTest'
          6        DO_FCALL                                      0  $8      
          7        ASSIGN                                                   !1, $8
    7     8        CLONE                                            ~10     !0
          9        INIT_METHOD_CALL                                         ~10, 'changeTest'
         10        DO_FCALL                                      0  $11     
         11        ASSIGN                                                   !2, $11
    9    12        INIT_FCALL                                               'var_dump'
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                                 
   10    15        INIT_FCALL                                               'var_dump'
         16        SEND_VAR                                                 !1
         17        DO_ICALL                                                 
         18      > RETURN                                                   1

Class Test:
Function changetest:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lX6TT
function name:  changeTest
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN_OBJ                                               'test'
          1        OP_DATA                                                  42
          2        FETCH_THIS                                       ~1      
          3      > RETURN                                                   ~1
          4*     > RETURN                                                   null

End of function changetest

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158 ms | 1395 KiB | 15 Q