[thelist] stupid PHP question

Jay Blanchard jay.blanchard at niicommunications.com
Thu Jul 7 09:13:34 CDT 2005


[snip]
What I don't understand is the syntax of this line:

	$row_count = is_array($row) ? count($row) : 0;
[/snip]

This is a ternary comparison form of an IF statement...read it like
this...

if(is_array($row)){ //this is the ?
   count($row);
} else { //this is the :
   0;
}

http://us3.php.net/ternary about 1/3rd down the page.


More information about the thelist mailing list