3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public $name; } function swap1($test) { $test = new Test(); $test->name = 1; } function swap2(&$test) { $test = new Test(); $test->name = 2; } function swap3($test) { $test->name = 3; } $test = new Test; $test->name = 0; var_dump($test->name); swap1($test); var_dump($test->name); swap2($test); var_dump($test->name); swap3($test); var_dump($test->name);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Ovifa
function name:  (null)
number of ops:  31
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   NEW                                              $1      'Test'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   22     3        ASSIGN_OBJ                                               !0, 'name'
          4        OP_DATA                                                  0
   24     5        INIT_FCALL                                               'var_dump'
          6        FETCH_OBJ_R                                      ~5      !0, 'name'
          7        SEND_VAL                                                 ~5
          8        DO_ICALL                                                 
   26     9        INIT_FCALL                                               'swap1'
         10        SEND_VAR                                                 !0
         11        DO_FCALL                                      0          
   28    12        INIT_FCALL                                               'var_dump'
         13        FETCH_OBJ_R                                      ~8      !0, 'name'
         14        SEND_VAL                                                 ~8
         15        DO_ICALL                                                 
   30    16        INIT_FCALL                                               'swap2'
         17        SEND_REF                                                 !0
         18        DO_FCALL                                      0          
   32    19        INIT_FCALL                                               'var_dump'
         20        FETCH_OBJ_R                                      ~11     !0, 'name'
         21        SEND_VAL                                                 ~11
         22        DO_ICALL                                                 
   34    23        INIT_FCALL                                               'swap3'
         24        SEND_VAR                                                 !0
         25        DO_FCALL                                      0          
   36    26        INIT_FCALL                                               'var_dump'
         27        FETCH_OBJ_R                                      ~14     !0, 'name'
         28        SEND_VAL                                                 ~14
         29        DO_ICALL                                                 
         30      > RETURN                                                   1

Function swap1:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Ovifa
function name:  swap1
number of ops:  7
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        NEW                                              $1      'Test'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
    9     4        ASSIGN_OBJ                                               !0, 'name'
          5        OP_DATA                                                  1
   10     6      > RETURN                                                   null

End of function swap1

Function swap2:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Ovifa
function name:  swap2
number of ops:  7
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   13     1        NEW                                              $1      'Test'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   14     4        ASSIGN_OBJ                                               !0, 'name'
          5        OP_DATA                                                  2
   15     6      > RETURN                                                   null

End of function swap2

Function swap3:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Ovifa
function name:  swap3
number of ops:  4
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
   18     1        ASSIGN_OBJ                                               !0, 'name'
          2        OP_DATA                                                  3
   19     3      > RETURN                                                   null

End of function swap3

Class Test: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.43 ms | 1403 KiB | 18 Q