3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Updating var1 would update var2 as well. $var1 = $var2 = Url::create(); $var1->setQuery(); var_dump($var2); // Clone shouldn't be an issue. $var3 = Url::create(); $var4 = clone $var3; $var3->setQuery(); var_dump($var4); class Url { protected $query = FALSE; public static function create() { return new static(); } public function setQuery() { $this->query = TRUE; return $this; } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9CP1N
function name:  (null)
number of ops:  20
compiled vars:  !0 = $var1, !1 = $var2, !2 = $var3, !3 = $var4
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   INIT_STATIC_METHOD_CALL                                  'Url', 'create'
          1        DO_FCALL                                      0  $4      
          2        ASSIGN                                           ~5      !1, $4
          3        ASSIGN                                                   !0, ~5
    5     4        INIT_METHOD_CALL                                         !0, 'setQuery'
          5        DO_FCALL                                      0          
    6     6        INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                                 
    9     9        INIT_STATIC_METHOD_CALL                                  'Url', 'create'
         10        DO_FCALL                                      0  $9      
         11        ASSIGN                                                   !2, $9
   10    12        CLONE                                            ~11     !2
         13        ASSIGN                                                   !3, ~11
   11    14        INIT_METHOD_CALL                                         !2, 'setQuery'
         15        DO_FCALL                                      0          
   12    16        INIT_FCALL                                               'var_dump'
         17        SEND_VAR                                                 !3
         18        DO_ICALL                                                 
   25    19      > RETURN                                                   1

Class Url:
Function create:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9CP1N
function name:  create
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   NEW                          static              $0      
          1        DO_FCALL                                      0          
          2      > RETURN                                                   $0
   19     3*     > RETURN                                                   null

End of function create

Function setquery:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9CP1N
function name:  setQuery
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   ASSIGN_OBJ                                               'query'
          1        OP_DATA                                                  <true>
   23     2        FETCH_THIS                                       ~1      
          3      > RETURN                                                   ~1
   24     4*     > RETURN                                                   null

End of function setquery

End of class Url.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.67 ms | 1401 KiB | 15 Q