note 45475 added to language.operators.arithmetic
| From: | arjini at gmail dot com | Date: | Wed, 08 Sep 2004 16:48:36 +0000 |
| Subject: | note 45475 added to language.operators.arithmetic | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-76237@lists.php.net to get a copy of this message | ||
When dealing purely with HTML, especially tables, or other things in "grids" the modulous
operator is really useful for splitting up the data with a seperator.
This snippet reads any gif files from the directory the script is in, prints them out and puts in a
break every 5th image.
<?php
$d = dir('./');
$i = 0;
while(false !== ($e = $d->read())){
if(strpos($e,'.gif')){
++$i;
echo '<img src="'.$e.'"/>'.chr(10);
if(!($i%5))
echo '<br/>';
}
}
?>
For tables just put </tr><tr> in place of the break.
----
Manual Page -- http://www.php.net/manual/en/language.operators.arithmetic.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+45475
Delete -- http://master.php.net/manage/user-notes.php?action=delete+45475&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+45475&report=yes
Search -- http://master.php.net/manage/user-notes.php