"Dhaval Desai" <[EMAIL PROTECTED]> wrote:
> what is the use of %
It returns a remainder. For example 7 % 2 = 1.
> Is it called modulo..what is it's use in PHP.?
There are plenty of situations where it's useful. For example, if you're
displaying data in rows and want to shade every other row:
if ( 1 == $row_count % 2 ) { echo "<tr><td>$data</td></tr>"; }
else { echo "<tr><td class='shade-1'>$data</td></tr>"; }
Or if you have a data set you want to display in an HTML table across
multiple rows, you'll probably find it useful for determining when to put
<tr> or </tr> as you loop through your data set and use it to calculate
whether you will need to fill cells at the end of the table with
non-breaking spaces. There are many other applications, but these two come
up pretty frequently in web applications.
--
Steve Werby
COO
24-7 Computer Services, LLC
Tel: 804.817.2470
http://www.247computing.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]