3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public function __set($name, $value) { echo func_get_arg(0); $name = "xxx"; echo func_get_arg(0); } public function test($name) { echo func_get_arg(0); $name = "xxx"; echo func_get_arg(0); } } $a = new A(); $a->test('test'); $a->test = 5; function byVal($arg) { echo 'As passed : ', var_export(func_get_arg(0)), PHP_EOL; $arg = 'baz'; echo 'After change : ', var_export(func_get_arg(0)), PHP_EOL; } function byRef(&$arg) { echo 'As passed : ', var_export(func_get_arg(0)), PHP_EOL; $arg = 'baz'; echo 'After change : ', var_export(func_get_arg(0)), PHP_EOL; } $arg = 'bar'; byVal($arg); byRef($arg);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7EXtG
function name:  (null)
number of ops:  16
compiled vars:  !0 = $a, !1 = $arg
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   NEW                                              $2      'A'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   18     3        INIT_METHOD_CALL                                         !0, 'test'
          4        SEND_VAL_EX                                              'test'
          5        DO_FCALL                                      0          
   19     6        ASSIGN_OBJ                                               !0, 'test'
          7        OP_DATA                                                  5
   34     8        ASSIGN                                                   !1, 'bar'
   35     9        INIT_FCALL                                               'byval'
         10        SEND_VAR                                                 !1
         11        DO_FCALL                                      0          
   36    12        INIT_FCALL                                               'byref'
         13        SEND_REF                                                 !1
         14        DO_FCALL                                      0          
         15      > RETURN                                                   1

Function byval:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7EXtG
function name:  byVal
number of ops:  21
compiled vars:  !0 = $arg
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV                                             !0      
   23     1        ECHO                                                     'As+passed+++++%3A+'
          2        INIT_FCALL                                               'var_export'
          3        INIT_FCALL                                               'func_get_arg'
          4        SEND_VAL                                                 0
          5        DO_ICALL                                         $1      
          6        SEND_VAR                                                 $1
          7        DO_ICALL                                         $2      
          8        ECHO                                                     $2
          9        ECHO                                                     '%0A'
   24    10        ASSIGN                                                   !0, 'baz'
   25    11        ECHO                                                     'After+change++%3A+'
         12        INIT_FCALL                                               'var_export'
         13        INIT_FCALL                                               'func_get_arg'
         14        SEND_VAL                                                 0
         15        DO_ICALL                                         $4      
         16        SEND_VAR                                                 $4
         17        DO_ICALL                                         $5      
         18        ECHO                                                     $5
         19        ECHO                                                     '%0A'
   26    20      > RETURN                                                   null

End of function byval

Function byref:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7EXtG
function name:  byRef
number of ops:  21
compiled vars:  !0 = $arg
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   RECV                                             !0      
   29     1        ECHO                                                     'As+passed+++++%3A+'
          2        INIT_FCALL                                               'var_export'
          3        INIT_FCALL                                               'func_get_arg'
          4        SEND_VAL                                                 0
          5        DO_ICALL                                         $1      
          6        SEND_VAR                                                 $1
          7        DO_ICALL                                         $2      
          8        ECHO                                                     $2
          9        ECHO                                                     '%0A'
   30    10        ASSIGN                                                   !0, 'baz'
   31    11        ECHO                                                     'After+change++%3A+'
         12        INIT_FCALL                                               'var_export'
         13        INIT_FCALL                                               'func_get_arg'
         14        SEND_VAL                                                 0
         15        DO_ICALL                                         $4      
         16        SEND_VAR                                                 $4
         17        DO_ICALL                                         $5      
         18        ECHO                                                     $5
         19        ECHO                                                     '%0A'
   32    20      > RETURN                                                   null

End of function byref

Class A:
Function __set:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7EXtG
function name:  __set
number of ops:  12
compiled vars:  !0 = $name, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        INIT_FCALL                                               'func_get_arg'
          3        SEND_VAL                                                 0
          4        DO_ICALL                                         $2      
          5        ECHO                                                     $2
    6     6        ASSIGN                                                   !0, 'xxx'
    7     7        INIT_FCALL                                               'func_get_arg'
          8        SEND_VAL                                                 0
          9        DO_ICALL                                         $4      
         10        ECHO                                                     $4
    8    11      > RETURN                                                   null

End of function __set

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7EXtG
function name:  test
number of ops:  11
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1        INIT_FCALL                                               'func_get_arg'
          2        SEND_VAL                                                 0
          3        DO_ICALL                                         $1      
          4        ECHO                                                     $1
   12     5        ASSIGN                                                   !0, 'xxx'
   13     6        INIT_FCALL                                               'func_get_arg'
          7        SEND_VAL                                                 0
          8        DO_ICALL                                         $3      
          9        ECHO                                                     $3
   14    10      > RETURN                                                   null

End of function test

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
185.07 ms | 1407 KiB | 19 Q