Re: Function Question
| From: | Huy Le | Date: | Fri, 08 Dec 2000 05:43:15 +0000 |
| Subject: | Re: Function Question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-29285@lists.php.net to get a copy of this message | ||
Do get what you want, replace your displayMe line:
echo displayMe ($z[0], $z[1], $z[2]);
with:
echo displayMe ($z[0]);
H
At 11:26 PM 12/7/2000 -0600, Jeff Lacy wrote:
>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