By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,751 Members | 1,149 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,751 IT Pros & Developers. It's quick & easy.

Re: getting parameters to send then to another function

P: n/a
..oO(Newsgroups)
>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?
>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
Sep 23 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.