Re: sprintf and arrays.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wednesday 06 April 2005 16:40, Brent Baisley wrote:
> For one, you are missing a right parenthesis ) in all of your examples.
> htmlentities(  sprintf( $tmp[0], $s, ENT_QUOTES )

Meh, syntax blip from the cut and paste.

> Second, the string you are trying to format only has one variable
> argument: $s.
>     Fred likes %1$s on his %2$s

The source array in this case has two entries.  My whole aim is to pass an 
array of n entries, unroll the array into a string and somehow interpolate 
the string into the sprintf call so that life is groovy.  I realise $s looks 
like a single variable to PHP at that point sprintf() is called, and this is 
what I'm trying to work around - some way to get sprintf to realise that $s 
is actually two strings.  Ie, I need a double level of interpolation on the 
$s value so that sprintf($tmp[0], $s) turns into sprintf(tmp[0], $array[0], 
$array[1]).  I'm starting to get the feeling that this will be impossible.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux