Re: printf() suggestion

From: Date: Wed, 19 Jul 2000 18:58:03 +0000
Subject: Re: printf() suggestion
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-7329@lists.php.net to get a copy of this message
Monte Ohrt, > 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? Functiona like that might as well just be written like a PHP function. Now that PHP4 supports an indeterminate number of function arguments i feel that making this isn't a problem. I really don't see the point of including it with PHP itself as it's such an easy function to write. -- Øyvind Grønnesby "Wow, I had knowledge!" --Buffy

« previous php.general (#7329) next »