as many will say =
assigns the value. however this is useful in if statements aswell
the if statement if($foo = 'somevalue')
is generally bad because it will always evaluate to true. however if($foo = $somevalue)
is somewhat a bit better because it's similar to what you see when checking the results of a database query, for instance with
if ($result = $mysqli->query("SELECT Name FROM City LIMIT 10"))
if $mysqli->query
is successful in running the if statement evaluates to true because the succesful retunr result of the function is not considered FALSE and inside your if statement you can expect that $result
to be usable for other mysqli_*
function.
however if $mysqli->query
is not successful it'll return false and the if statement evaluates to false and you can set up an else statement to output an error. you will get the same result if you did
$somevalue = $mysqli->query("SELECT Name FROM City LIMIT 10")
if($foo = $somevalue)
but you kinda waste time doing an extra line like this when you can just skip $somevalue
all together