Variable Argument List
| From: | Daniel Kolbo | Date: | Sat, 15 Nov 2008 01:13:56 +0000 |
| Subject: | Variable Argument List | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-283315@lists.php.net to get a copy of this message | ||
Hello,
I am trying to do something like the following:
<?php
function hello($var1 = 'default1', $var2 = 'default2') {
echo "$var1:$var2";
}
$func= "hello";
$args = "'yo','bob'";
$func($args);
?>
I understand why this outputs:
'yo','bob':default2
However, I want it to output:
yo:bob
Is this possible? I tried using different combinations of {}, but I cannot seem to get it to happen. I need some kind of "preprocessor" feature perhaps.
Thanks,
dK