The English language can be just as confusing at times, and is full of
exceptions to rules - people just get used to them. The same can apply to a
programming language. I'm not of why PHP's naming conventions are like this,
but I can only assume it's to do with the way the language has evolved,
perhaps inheriting naming conventions from other languages. I can't imagine
there are any plans to standardise it.

In practice, I find that all my code is wrapped up in custom functions and
objects anyway - I name those quite carefully to avoid confusing myself and
others, but don't need to worry too much about the naming conventions of the
functions inside. When writing complicated scripts, I  often find choosing
variable / function naming conventions takes a long time.

I've got used to the quirks of PHP, but can see your point.

Chris


-----Original Message-----
From: Eugene Lee [mailto:[EMAIL PROTECTED]
Sent: 17 September 2003 10:51
To: [EMAIL PROTECTED]
Subject: [PHP] consistent PHP function names?


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?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
 
If you are not the intended recipient of this e-mail, please preserve the
confidentiality of it and advise the sender immediately of any error in
transmission. Any disclosure, copying, distribution or action taken, or
omitted to be taken, by an unauthorised recipient in reliance upon the
contents of this e-mail is prohibited. Somerfield cannot accept liability
for any damage which you may sustain as a result of software viruses so
please carry out your own virus checks before opening an attachment. In
replying to this e-mail you are granting the right for that reply to be
forwarded to any other individual within the business and also to be read by
others. Any views expressed by an individual within this message do not
necessarily reflect the views of Somerfield.  Somerfield reserves the right
to intercept, monitor and record communications for lawful business
purposes.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to