printf() suggestion
| From: | Monte Ohrt | Date: | Tue, 18 Jul 2000 19:51:22 +0000 |
| Subject: | printf() suggestion | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-7140@lists.php.net to get a copy of this message | ||
Hi,
I'm just looking for a general consensus on an idea:
How about extending the functionality of printf() and sprintf()
with a way to format html-encoded and url-encoded strings?
For an example, this:
printf("%h,%u",$string1,$string2);
would be a shorthand way of doing this:
printf("%s,%s",htmlspecialchars($string1),urlencode($string2));
pros:
*) easier to remember and shorter to type than htmlspecialchars()
*) maybe faster, especially if printf() is already being used
*) doesn't break any backward compatibility
*) consolidates some functionality of php to one function call,
constructive toward tighter php code and leaner php language.
cons:
*) duplicates existing functionality
What do you think?
Monte