php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #1436 Standard function names are not indicative of what they do.
Submitted: 1999-05-21 09:03 UTC Modified: 1999-05-21 11:38 UTC
From: danbeck at scott dot net Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 3.0.7 OS: All
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: danbeck at scott dot net
New email:
PHP Version: OS:

 

 [1999-05-21 09:03 UTC] danbeck at scott dot net
This has been a beef for some time now.  Many functions in PHP are not indicative of what they actually do.  Several functions names seem to be descriptive of what they do, but they are not good function names.

For example:

AddSlashes() The name says it all... it adds slashes.  BUT, why does it add slashes, what does it add slashes to, how many times will it add slashes.  Why would you want to add slashes?  The function doesn't actually give you an indication of where it might be used, only that it adds slashes to something.

A better choice would have been something along the lines of quote_sql_str() When you first look at it, what does it tell you it probably does?  Easy, it works with a string, it has something to do with SQL or databases and it quotes something in that string.  Any database developer on the planet would immediately come to the conclusion that this function might help them complete the task of making sure there are no un-escaped quotes, backslashes or nulls in a string before sending it along in a database query.

Many functions in PHP were taken from their perl or C++ counterparts and make perfect sense, but there are a large number of custom functions that were given names that just don't tell you much.  If you are searching through the string section for a specific function that would escape characters in a sql string, how would you find AddSlashes() without looking through each and every function?  You can't!  You can't search for sql, escape or any other keywords...

Anyway, I love PHP and this is only a minor problem, but it would be nice if some of the function names were updated with more accurate names.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-05-21 11:38 UTC] jim at cvs dot php dot net
This is a documentation problem. We're not going to go
around renaming any functions.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Tue Jun 16 16:00:01 2026 UTC