PHP manual says you have to do sort($array). $array will be passed by reference, so sort() will modify $myArray.
I’m just wondering if there is any problem or implication if you do sort(&$myArray).
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.
To give a more detailed answer:
The reasoning for deprecating pass-by-references is diffuse. It’s mostly code-cleanliness. Secondly it was commonly misused by newcomers, leading to side-effects if unsupervised. (If newcomer misuse ever was a good reason for deprecation, then
mysql_queryshould have been long gone.)And thirdly, there are in fact some internal memory management issues with passing parameters by reference when the ZendVM does not expect it. (Quercus and Project Zero do not have such issues.)