In C++ you could do like this, to ensure that the parameter you passed by reference is not going to be modified:
void function Foo(const ¶m){}
How can i do the same in PHP?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No you cant, if you want just read it create copy of that variable, but overall if you dont need references dont use them, as it looks in this case. References wont give you any performance benefits on php.