Re: Resurrecting the Function Renaming Thread

From: Date: Wed, 07 Feb 2001 17:15:46 +0000
Subject: Re: Resurrecting the Function Renaming Thread
References: 1  Groups: php.qa 
Request: Send a blank email to php-qa+get-2292@lists.php.net to get a copy of this message
> >James is right.. PHP was never designed and implemented in a clean room > >by a single person (unlike Python) - it's a glue language that's been > >evolving according to what its users wanted to take from and give to it. > >That said, standardizing function names seems like a good idea - but it > >will only help newcomers - experienced PHP coders will not benefit from > >this change. We also have to take into account the pros and cons of this > >change - once it's done we will suddenly have strlen() _and_ str_len() > >and newcomers may be confused... > > >-Andrei > > So the answer to it is, don't give newcomers the option to know about the > old function name ( strlen() ), the manuals can be changed so that only the > new function names are shown and the manual with the old names in can be > archived somewhere for reference for anyone who needs it, but hopefully > no-one would need it as they could move over to the new function names - I > know that it isn't an easy task as the manual is huge, even just for the > English version. > <?php if (str_len($x) == 0) { echo "String length is 0"; } echo str_len($foo); $bar = str_len($foo); ?> Ugggghhhhhhhhh. I don't think any language should reccomend a syntax like that. strlen() is fine, its a standard function that's been in PHP and is in many languages. There's no reason to blindly start renaming PHP functions to conform to a naming standard. Ok, yes, fine, for some functions it does make sense, all mysql functions, should be and are prefixed with mysql_*. But in some cases it does. A function that tokenizes strings should be strtok() a function that gets the length of a string should be strlen(). A function that add's slashes to a string should be addslashes not str_addslashes() which looks better: $str = AddSlashes($str); or $str = str_addslashes($str); ??? I'd say it would be best to leave php's basic functions alone (maybe one or two)... And maybe look at the extensions which are mostly ns protected. -Sterling

« previous php.qa (#2292) next »