Re: Function Question
| From: | Marcelo Gulin | Date: | Fri, 08 Dec 2000 15:44:34 +0000 |
| Subject: | Re: Function Question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-29363@lists.php.net to get a copy of this message | ||
Hi Jeff!
Try...
<?php
function displayMe ($string, $number = '', $name = 'Bob Villa') {
$a = "$string $name the $number<br>";
return $a;
}
$z = array ('Sux doeth');
echo displayMe ($z[0] );
?>
good luck
Marcelo Gulin
Jeff Lacy escribió:
> Hello World,
> I have a question about functions and arrays. Assume I have a script
> like so:
>
> <?php
> function displayMe ($string, $number = '', $name = 'Bob Villa') {
> $a = "$string $name the $number<br>";
> return $a;
> }
>
> $z = array ('Sux doeth');
>
> echo displayMe ($z[0], $z[1], $z[2]);
> ?>
>
> I would be much happier if this printed 'Sux doeth Bob Villa the<br>',
> but it doesn't.
> It comes back with 'Sux doeth the <br>'. Is there an easy way around this,
> or do I have to use an if? Thanks a bunch, everyone!
>
> Cheers :-)
>
> Jeff
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net