= equals =

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
LiveFree
Forum Contributor
Posts: 258
Joined: Tue Dec 06, 2005 5:34 pm
Location: W-Town

= equals =

Post 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 :)
bdlang
Forum Contributor
Posts: 395
Joined: Tue May 16, 2006 8:46 pm
Location: Ventura, CA US

Post 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
LiveFree
Forum Contributor
Posts: 258
Joined: Tue Dec 06, 2005 5:34 pm
Location: W-Town

Post 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!
Post Reply