Re: Language class for PEAR?

From: Date: Wed, 03 Apr 2002 21:32:47 +0000
Subject: Re: Language class for PEAR?
References: 1 2 3 4  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-5184@lists.php.net to get a copy of this message
On Wed, 2002-04-03 at 19:17, Colin Viebrock wrote: > > > Sorry for the really delayed response, but this can be done as follows: > > > > > > EN: $format="Welcome %s to %s!"; > > > sprintf($format, $APP, $USER ); > > > > > > DE: $format = "Willkommen %2$s, %1$s!"; > > > sprintf($format, $APP, $USER ); > > > > > > Bascially, that functionality is built into sprintf(). > > > > But not in PHP's *printf. It's a great feature though, someone should > > implement it. :-) > > Sure it is: > > <?php > > $name = 'Stig'; > $app = 'PHP'; > > printf('Welcome %s to %s!', $name, $app); > printf('Welcome to %2$s, %1$s', $name, $app); > > ?> Doooh, I used double quotes in the format string :-) - Stig

« previous php.pear.dev (#5184) next »