3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = 0; function passByReference(&$a) { $a = 5; //return $a++; } function passByValue($a) { return --$a; } echo $a."\n"; $b = passByValue($a); echo "b = $b \n"; echo $a."\n"; passByReference($a); echo $a."\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FK1Yj
function name:  (null)
number of ops:  19
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 0
   16     1        CONCAT                                           ~3      !0, '%0A'
          2        ECHO                                                     ~3
   18     3        INIT_FCALL                                               'passbyvalue'
          4        SEND_VAR                                                 !0
          5        DO_FCALL                                      0  $4      
          6        ASSIGN                                                   !1, $4
   20     7        ROPE_INIT                                     3  ~7      'b+%3D+'
          8        ROPE_ADD                                      1  ~7      ~7, !1
          9        ROPE_END                                      2  ~6      ~7, '+%0A'
         10        ECHO                                                     ~6
   22    11        CONCAT                                           ~9      !0, '%0A'
         12        ECHO                                                     ~9
   24    13        INIT_FCALL                                               'passbyreference'
         14        SEND_REF                                                 !0
         15        DO_FCALL                                      0          
   26    16        CONCAT                                           ~11     !0, '%0A'
         17        ECHO                                                     ~11
         18      > RETURN                                                   1

Function passbyreference:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FK1Yj
function name:  passByReference
number of ops:  3
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    7     1        ASSIGN                                                   !0, 5
    9     2      > RETURN                                                   null

End of function passbyreference

Function passbyvalue:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FK1Yj
function name:  passByValue
number of ops:  4
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   13     1        PRE_DEC                                          ~1      !0
          2      > RETURN                                                   ~1
   14     3*     > RETURN                                                   null

End of function passbyvalue

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.37 ms | 1399 KiB | 15 Q