Bug #52424 [Com]: Function naming inconsistency: htmlentities() x html_entity_decode()

From: Date: Wed, 23 Jan 2013 17:06:12 +0000
Subject: Bug #52424 [Com]: Function naming inconsistency: htmlentities() x html_entity_decode()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-176198@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=52424&edit=1

 ID:                 52424
 Comment by:         lenton64 at gmail dot com
 Reported by:        php-bugs at majkl578 dot cz
 Summary:            Function naming inconsistency: htmlentities() x
                     html_entity_decode()
 Status:             Wont fix
 Type:               Bug
 Package:            Unknown/Other Function
 PHP Version:        5.3.3
 Block user comment: N
 Private report:     N

 New Comment:

I feel that this is a big problem in PHP. It makes it super hard to remember 
function names (especially for newcomers) with these inconsistencies and gives 
PHP an ugly syntax reputation.

Please change all function names to:
words_separated_with_underscore()

and then alias the original functions to the new ones.

It may take a long time for everyone to change the functions in their 
applications but you can keep them aliased for however long everyone needs.

This naming convention needs to become a standard in PHP at some point, why not 
get the ball rolling now.


Previous Comments:
------------------------------------------------------------------------
[2010-07-29 02:09:38] rasmus@php.net

We don't mind change, but our users really really don't like it when we break 
their working applications for cosmetic reasons.

------------------------------------------------------------------------
[2010-07-29 02:05:31] php-bugs at majkl578 dot cz

Yes and that is what I think should change, because current naming conventions are really horrible.
For instance, look at differences between str_replace, strlen, parse_str, htmlspecialchars. All work
with same type but their names are completely different.
So, string functions should go to String namespace (String\replace()), array functions to Array
namespace (Array\search()) and so on.

But unfortunately this will not happen because PHP does not like changes... Think about it.

------------------------------------------------------------------------
[2010-07-25 00:19:32] giorgio dot liscio at email dot it

php functions uses a lot of different syntax

isset
is_array
isPublic

but aliasing is evil and renaming is not appreciated by users... the best thing you can do is
implement your renamed function in your namespace

bye

------------------------------------------------------------------------
[2010-07-24 07:11:06] php-bugs at majkl578 dot cz

Description:
------------
I suggest adding a function htmlentities_decode() as a replacement for html_entity_decode() and
possibly deprecate that one.
It is really misleading and unintuitive because there are functions htmlspecialchars() and
htmlspecialchars_decode() doing similar thing.



------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=52424&edit=1


Thread (13 messages)

« previous php.bugs (#176198) next »