note 16586 added to function.explode

From: Date: Mon, 05 Nov 2001 12:16:42 +0000
Subject: note 16586 added to function.explode
Groups: php.notes 
Request: Send a blank email to php-notes+get-20458@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="&nbsp"; 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+16586 http://master.php.net/manage/user-notes.php?action=delete+16586 http://master.php.net/manage/user-notes.php?action=reject+16586

« previous php.notes (#20458) next »