가능한 중복 :
PHP function with unlimited number of parameters
How to pass array as multiple parameters to function?PHP에서 가변 개수의 매개 변수를 사용하려면 어떻게해야합니까?
내가 좀 sprintf
의 최대 재미있게 버전처럼, PHP에서 매개 변수의 변수 번호와 함수를 만들려고합니다. 예 : 어디 sprintf
다음과 같습니다
function my_special_printf($special, $format, ....lots of args...)
{
// do something with $special here
return sprintf($format, .. lots of args...);
}
가 어떻게이게 가능 :
$res = sprintf("The number is %d and the string is %s", $num, $str);
를 인수 임의의 숫자로,이 같은 일을하고 싶어?
가능한 중복 http://stackoverflow.com/questions/1577383/php-function-with-unlimited-number-of-parameters) ... 가장 많이 투표 된 답변을 살펴보십시오. 또는 [PHP 함수가 무제한의 매개 변수를 허용 할 수 있습니까?] (http://stackoverflow.com/questions/3078454/can-a-php-function-accept-an-unlimited-number-of-parameters) –
이 질문은 또한 이러한 매개 변수를 다른 함수에 전달하는 방법을 제시합니다. – izb
@FelixKling : 그렇지 않습니다. 이 질문은 반대의 질문입니다! –