note 16585 added to function.explode
| From: | sultanzahir at yahoo dot com | Date: | Mon, 05 Nov 2001 12:16:20 +0000 |
| Subject: | note 16585 added to function.explode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-20457@lists.php.net to get a copy of this message | ||
<?php
function TROut($message) { /*And NO comments about fish, please! ;) */
PRINT "<TR>\n";
$cells=explode("|",$message);
$iterations=count($cells);
$i=0;
while ($i<$iterations) {
list($message,$span)=explode(":",$cells[$i]);
if (strlen($message)<1) $message=" ";
if ($span){
$this->TDOut ($message,$span);
}else{
$this->TDOut ($message);
}
$i++;
}
PRINT "</TR>\n";
}
?>
<TABLE>
<?
$Theader->TROut("Name:2|Address:3");
$Theader->TROut("First|Last|City|State/Province|Country");
$Tbody->TROut("Rod|Kreisler|Cortlandt|New York|USA");
?>
</TABLE>
Wow. That's a lot easier. But what if the data is in variables? Simply join the array:
<?php
$message=join($arry,"|");
$Tbody->TROut($message);
?>
--
http://www.php.net/manual/en/function.explode.php
http://master.php.net/manage/user-notes.php?action=edit+16585
http://master.php.net/manage/user-notes.php?action=delete+16585
http://master.php.net/manage/user-notes.php?action=reject+16585