for example shuffle(&$array);
is it a bad practice to leave out the & sign when passing argument to functions like this one? Because it’s working without it too…
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.
In PHP 5.3 it is bad, in earlier versions I suppose on some sort of meta way it can help the next person to read the code, but it generally is not the best idea just because it doesn’t really do anything and most people will be confused by its inclusion (why is this person doing that? I don’t get it…).
&is used only four times:$a =& $b(a references b)function inc(&$b){$b++;}(b will now increment outside of func)function &get_thing(){ static $thing; return $thing; }(You can now modify the static value)foreach($var as $key=>&$val){$val++;}