note 87761 deleted from function.array-count-values by danbrown

From: Date: Fri, 19 Dec 2008 23:54:44 +0000
Subject: note 87761 deleted from function.array-count-values by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-148374@lists.php.net to get a copy of this message
Note Submitter: Vladimir Kornea ---- 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().

« previous php.notes (#148374) next »