Page 1 of 1

= equals =

Posted: Wed Jun 21, 2006 9:39 pm
by LiveFree
HEy All,

Got a little offhand question here while Ive been thinking of slimming down my code. Could I do this to shortcut assign a var to an array from a mysql_fetch_array?

Code: Select all

$id = $row['id'] = mysql_fetch_array($sql);
And if not, Ive seen the double ='s before, could someone explain their syntax.

Thanks :)

Posted: Wed Jun 21, 2006 9:55 pm
by bdlang
PHP will honor that assignment syntax, but not in that context. You likely want to use list().

The "double ='s" as you put it are a conditional operator.

PHP Manual: Operators

Posted: Wed Jun 21, 2006 10:13 pm
by LiveFree
Aha!

Looking over my BlogCode script (sorta like bbCode), I realize I have been using the list()'s for the whole time now. I just never realized what context I was talking about.

Thanks!