Problems with sprintf and swapping variables

From: Date: Mon, 30 Apr 2001 21:33:43 +0000
Subject: Problems with sprintf and swapping variables
Groups: php.general 
Request: Send a blank email to php-general+get-50916@lists.php.net to get a copy of this message
Ok.. now I hope that somebody can help with this one... I'm trying to write a form field on a webpage that makes data entry of ever changing fields easy.. In otherwords: Enter Style: You might enter: Hello %s, how are you today.. I am fine.. I here you are turning %d. Now this works when you pass sprintf($text, $name, $age); but if you in the text say. Happy %2/$d'th birthday %1/$s. like the docs says your supposed to do it doesn't work and all you see is: Happy $d'th birthday $s. What is up with this.. if you use %2/%d it sort of works, but it throws all my other variables out of whack.. any help with this would be appreciative.. later, Ed McLain ed@edmclain.com

« previous php.general (#50916) next »