Newsgroups wrote:
Your best bet would probably be to pass the function an array of your
variables and then extract them inside the function for use.
Remember that you have to pass the same number of parameters into the
function as what it was designed for.
Your function above would fail as the $key2 would not make it inside the
function.
Scotty
Hi, I'm trying something...
>
My goal is to have a unique function with undeterminated number of
parameters witch return the sprintf result.
>
<?php
print test("key", "key2");
function test($k)
{
return sprintf("test %s %s", $k);
}
?>
>
So, in this case, when we are calling test() function, we need 2 parameters
because sprintf require 2 "%s"...
but I don't know how to send the test() parameter's into the sprintf's ones
...
>
Do you understand ? ansd do you have any solution ? thanks.
>
>
>
>
My goal is to have a unique function with undeterminated number of
parameters witch return the sprintf result.
>
<?php
print test("key", "key2");
function test($k)
{
return sprintf("test %s %s", $k);
}
?>
>
So, in this case, when we are calling test() function, we need 2 parameters
because sprintf require 2 "%s"...
but I don't know how to send the test() parameter's into the sprintf's ones
...
>
Do you understand ? ansd do you have any solution ? thanks.
>
>
>
variables and then extract them inside the function for use.
Remember that you have to pass the same number of parameters into the
function as what it was designed for.
Your function above would fail as the $key2 would not make it inside the
function.
Scotty