php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #50099 Suggestion: Deprecate sizeof
Submitted: 2009-11-06 12:35 UTC Modified: 2021-01-08 13:08 UTC
Votes:8
Avg. Score:3.8 ± 1.3
Reproduced:4 of 5 (80.0%)
Same Version:1 (25.0%)
Same OS:3 (75.0%)
From: martin dot contento at gmail dot com Assigned:
Status: Suspended Package: Scripting Engine problem
PHP Version: 5.3SVN-2009-11-06 (SVN) OS: Linux
Private report: No CVE-ID: None
 [2009-11-06 12:35 UTC] martin dot contento at gmail dot com
Description:
------------
Summary says it all: I would like to nominate "sizeof()" for deprecation.

Reason:
* sizeof already is only an alias of count
* a deprecation warning would discourage people from using it, making php just a little bit more "unified"
* "count" is the better name, sizeof could be confused with the C function which does something different (we all had a "sizeof(array) / sizeof(array[0])" macro, didn't we?)
* it would end the (rather silly) "which function is faster" discussions around those two


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-12-01 16:30 UTC] jani@php.net
-Package: Feature/Change Request +Package: Scripting Engine problem
 [2014-03-05 20:29 UTC] narf at devilix dot net
This should be considered for PHP6 (or whatever PHP5++ is called).
 [2021-01-08 13:08 UTC] cmb@php.net
-Status: Open +Status: Suspended
 [2021-01-08 13:08 UTC] cmb@php.net
This needs to be discussed on the internals mailing list, and may
require an RFC[1].  Feel free to forward the request to the
mailing list.  For the time being, I'm suspending this ticket.

[1] <https://wiki.php.net/rfc/howto>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 03:01:28 2024 UTC