I’ve seen something like this used in WordPress:
if($aVariable=aFunction()){
// If aFunction() returned true
}
What is this called and where can I find more information about it?
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.
“Inline assignment” is what I’d call it.
It is equivalent to:
And if $aVariable isn’t used somewhere else, it is pointless to do this.
So someplace else there needs to a useful read of $aVariable.
There isn’t a lot else to say about this, except that it saves a few keystrokes, when you need to check the result of aFunction more than once.