RE: [PHP] Populate var with function output string?
| From: | David Freeman | Date: | Tue, 04 Mar 2003 01:18:23 +0000 |
| Subject: | RE: [PHP] Populate var with function output string? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-138007@lists.php.net to get a copy of this message | ||
> *******************************
> function write_string(count) {
>
> for ($x = 0; $x < $count; $x++) {
>
> echo "<option value=$x> Row $x</option>";
>
> }
>
> }
>
> $my_string = write_string(5);
>
> echo $my_string;
> *******************************
----8<-----Untested Code-----8<-----
function write_string(count)
{
$string = "";
for ($x = 0; $x < $count; $x++)
{
$string .= "<option value=$x>Row $x</option>";
}
return $string;
}
$my_string = write_string(5);
echo $my_string;
----8<-----Untested Code-----8<-----
Season to taste...
CYA, Dave