consistent PHP function names?
| From: | Eugene Lee | Date: | Wed, 17 Sep 2003 10:51:24 +0000 |
| Subject: | consistent PHP function names? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-162850@lists.php.net to get a copy of this message | ||
One thing that's always bothered me about PHP is that the function names
are not terribly consistent. For example, when are underscores okay?
strip_tags() has an underscore but stripslashes() does not. Also,
should inverse functions be named appropriately? htmlentities() and
html_entity_decode() are inverse functions. But seems to make more
sense to rename htmlentities() to html_entity_encode(). Something like
a class[_subclass1[_subclass2[...]]]_method nomenclature makes sense.
Then you have really weird stuff. For example, md5() is listed as a
"string function" since it takes a string, calculates the MD5 hash, and
returns said hash. Makes sense. Then you have md5_file(), which takes
a filename, calculates the MD5 hash of the file's contents, and returns
said hash. But md5_file() is listed as a "string function". To me, it
makes more sense to be classified as a "filesystem function", and maybe
even rename the function to file_md5().
Thoughts?