Reply to Re: [PHP] sprintf and arrays.

Your name:

Reply:


Posted by Duncan Hill on 04/06/05 19:46

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.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация