Connecting Tech Pros Worldwide Forums | Help | Site Map

Re: getting parameters to send then to another function

Michael Fesser
Guest
 
Posts: n/a
#1: Sep 23 '08
..oO(Newsgroups)
Quote:
>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"...
Why sprintf()? Why not simply implode() all parameters?
Quote:
>but I don't know how to send the test() parameter's into the sprintf's ones
>...
Have a look at func_get_args() and the like.

Micha

Closed Thread