What PHP versions supports this:
function mytest($mVar = null) {
($mVar === null) and ($mVar = "Hello"); // <--- This line
echo $mVar;
}
Does it work in PHP versions lower than 5.3.x ?
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.
It works on all versions you might encounter, there’s nothing special to it. All of the operators (
===,and,=) have been there since the dawn of time (official scientific term).Of course you don’t have to take my word for it; you can always see for yourself.
Edit: Of course, I really don’t see the point in the code above. You could have written the equivalent and simpler
or even