note 87761 added to function.array-count-values
| From: | VladimirKornea at osu1 dot php dot net | Date: | Fri, 19 Dec 2008 23:50:54 +0000 |
| Subject: | note 87761 added to function.array-count-values | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-148373@lists.php.net to get a copy of this message | ||
Note that psbauman's comment is wrong. In this example:
$id_numbers[0] = 0056789;
$id_numbers[1] = 0012345;
$id_numbers[2] = 0012345;
A leading 0 tells PHP that we're using octal notation. 0056789 in octal gets cuts down to 567
(leading 0 ignored since integers are incapable of storing them, 8 & 9 ignored since they
don't exist in octal notation). Since var_dump() prints in decimal, the octal 567 will be
printed as 375; 0012345 becomes 5349.
So perhaps psbauman actually did this:
$id_numbers[0] = '0056789';
$id_numbers[1] = '0012345';
$id_numbers[2] = '0012345';
However, a var_dump() of that array will print the leading zeroes.
So perhaps the comment is a muddled attempt to communicate that array_count_values() will cast
numeric strings to integers. However, this is not the case either.
Even if everything else psbauman said were true, it would still make no sense to run $id_numbers
through array_values() before passing it to array_count_values().
----
Server IP: 208.69.120.35
Probable Submitter: 65.106.184.150
----
Manual Page -- http://www.php.net/manual/en/function.array-count-values.php
Edit -- https://master.php.net/note/edit/87761
Del: integrated -- https://master.php.net/note/delete/87761/integrated
Del: useless -- https://master.php.net/note/delete/87761/useless
Del: bad code -- https://master.php.net/note/delete/87761/bad+code
Del: spam -- https://master.php.net/note/delete/87761/spam
Del: non-english -- https://master.php.net/note/delete/87761/non-english
Del: in docs -- https://master.php.net/note/delete/87761/in+docs
Del: other reasons-- https://master.php.net/note/delete/87761
Reject -- https://master.php.net/note/reject/87761
Search -- https://master.php.net/manage/user-notes.php