Simetrical wrote:
You have to wonder why PHP complains when given a constant for a pass-by-reference function, though. I guess they figure that explicit pass-by-reference usually means that some kind of return value is stored in the variable and they don't want people to mistakenly ignore it, but it still seems fairly pointless to force people to manually create a throwaway variable.
Perhaps they were motivated by some dim memory of the legendary old FORTRAN compilers, where (since everything was passed by reference) if you ran the program
program main x = f(5) j = 5 stop
real function f(i) i = 42 return
it would set j to 42. (The program would, in effect, modify itself, you see.)