Function Question
| From: | Jeff Lacy | Date: | Fri, 08 Dec 2000 05:26:52 +0000 |
| Subject: | Function Question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-29284@lists.php.net to get a copy of this message | ||
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