Web Hosting Talk







View Full Version : php if statement


feelexit
08-17-2004, 11:37 PM
I cannot believe i m asking question about if statement.

I just coudn't figure out wht it doesnot work.

if i comment out the || ($i == 0) from the if statement, following codes work, but i dont know why it doesnt work with || ($i == 0)

<?

$str = "";
$col = 3;
$i = 1;



$strProduct = array();
$strProduct[0] = "abc";
$strProduct[1] = "2233";
$strProduct[2] = "4444";

if ((sizeof($strProduct) % $col) == 0) || ($i == 0) // bug here. please help
{
$str .= 'tr>td>';
}
else
{
$str .= 'td>';
}

echo $str;
/**/
?>

SimplyDiff
08-17-2004, 11:53 PM
if ((sizeof($strProduct) % $col) == 0 || ($i == 0))

ferox
08-18-2004, 12:28 AM
Yes you were missing ) after this statement.
if ((sizeof($strProduct) % $col) == 0) || ($i == 0)