| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
  [2021-08-14 09:11 UTC] rh at hofercomputing dot ch
 Description:
------------
function a(&$p){
    $p++;
}
a($x=18);
this produces "Uncaught Error: a(): Argument #1 ($p) cannot be passed by reference in "
but $x is a variable, and this was accepted in recent versions.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             
             | 
    |||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 16:00:01 2025 UTC | 
function a(&$p){ $p++; } $x=18; a($x); Why do i have to divide in 2 statements? Immediate assignement in a function call is just an elegant way of compact coding. And the interpreter should do exactly this: first: assign the paramter, then call the function. I see no reason not to so!