Jump to content

assignment operator return values


ala888

Recommended Posts

conditional statements evaluate expressions. so if that expression evaluates to true, then the if condition will be met. it's optional to assign the return value of the function to $x in this case, unless you actually plan to use it later

Link to comment
Share on other sites

When you evaluate an assignment expression, it evaluates the part on the left, the variable that got the assignment. So the value of ($x = func()) is the same as the value of $x. This page lists the values that will evaluate to false, everything else will evaluate to true:http://php.net/manual/en/language.types.boolean.php

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...