note 114346 added to control-structures.foreach
| From: | mvaqasuddin at gmail dot com | Date: | Tue, 11 Feb 2014 14:56:59 +0000 |
| Subject: | note 114346 added to control-structures.foreach | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-198455@lists.php.net to get a copy of this message | ||
more control over foreach you can use these code for zebra stripping in table class or other.
foreach ( $data as $key => $row ) {
$class = fmod( $key,2 ) ? 'even' : 'odd';
echo '<tr class = "'.$class.'" >';
foreach ( $row as $cell ) {
echo "<td>$cell</td>";
}
echo "</tr>";
}
----
Server IP: 202.5.128.4
Probable Submitter: 180.92.156.26
----
Manual Page -- http://php.net/manual/en/control-structures.foreach.php
Edit -- https://master.php.net/note/edit/114346
Del: integrated -- https://master.php.net/note/delete/114346/integrated
Del: useless -- https://master.php.net/note/delete/114346/useless
Del: bad code -- https://master.php.net/note/delete/114346/bad+code
Del: spam -- https://master.php.net/note/delete/114346/spam
Del: non-english -- https://master.php.net/note/delete/114346/non-english
Del: in docs -- https://master.php.net/note/delete/114346/in+docs
Del: other reasons-- https://master.php.net/note/delete/114346
Reject -- https://master.php.net/note/reject/114346
Search -- https://master.php.net/manage/user-notes.php