php - What does $var = value actually return? -
this seems mysterious part of php me, , wondering if clarify because manual doesn't seem include (or couldn't find anywhere).
what of these things return?
if($c = mysql_connect($host, $user, $pass)){ echo 'success'; }else{ echo 'failure'; }
would echo 'success' because $c assigned true or false? i'm wondering if can or if have define $c on previous line.
thanks.
it mentioned in assignment operators:
the value of assignment expression value assigned. is, value of "$a = 3"
3
.
so $c = ...
result in true
if true
assigned $c
, in false
if false
assigned.
that reason why iterating on query results
while(($row = mysql_fetch_array(...)))
works.
Comments
Post a Comment