Well I figured out a solution. Using a combination of explode() to
create an array from $bar,
check to see if $bar is an array and
feed the array to vprintf()....
Gerard Samuel wrote:
> Im trying to make a dynamic printf().
> By that I mean ->
>
> function this($foo, $bar)
> {
> if (strlen($bar) == '0')
> {
> print($foo);
> }
> else
> {
> printf($foo, $bar);
> }
> }
>
> Now it works if there is one argument passed, but it doesn't when
> there is more than one.
>
> $str = 'should';
> this('This %s work', $str); // work
>
> $str = 'is, a';
> this('This %s just %s test', $str); // doesn't work
>
> So I guess, arguments passed to it has to be physical arguments, and
> not represented in a string.
> Am I banging my head on a wall with this??
> Thanks
>
--
Gerard Samuel
http://www.trini0.org:81/
http://dev.trini0.org:81/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php