|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-08-24 08:02 UTC] php_bugs at michaeldouma dot com
[2004-08-26 02:26 UTC] iliaa@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 18:00:01 2025 UTC |
Description: ------------ Similar to Bug?#28435 which should not be closed. Can not access results from array_count_values when counting strings which happen to be numbers. Reproduce code: --------------- $items1 = array (1,2,2,3,3,3); $hist1 = array_count_values ($items1); print "\nworks: ".join(",", $hist1); print "\nworks: ".$hist1[1].",".$hist1[2].",".$hist1[3]; print "\nworks: ".$hist1["1"].",".$hist1["2"].",".$hist1["3"]; $items2 = array ("1","2","2","3","3","3","z","z"); $hist2 = array_count_values ($items2); print "\nworks: ".join(",", $hist2); print "\nfails: ".$hist2[1].",".$hist2[2].",".$hist2[3]; print "\nfails: ".$hist2["1"].",".$hist2["2"].",".$hist2["3"].",".$hist2["z"]; print "\n\n"; var_dump($hist1); var_dump($hist2); Expected result: ---------------- works: 1,2,3 works: 1,2,3 works: 1,2,3 works: 1,2,3,2 fails: ,, fails: ,,,2 Actual result: -------------- works: 1,2,3 works: 1,2,3 works: 1,2,3 works: 1,2,3,2 fails: 1,2,3 fails: 1,2,3,2