note 72386 added to function.array-count-values
| From: | meyermagic at gmail dot com | Date: | Wed, 17 Jan 2007 02:43:09 +0000 |
| Subject: | note 72386 added to function.array-count-values | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-121825@lists.php.net to get a copy of this message | ||
Scratch that, I did something stupid. Here is a better function.
<?php
function array_enumerate_keys($array)
{
$index = 0;
$enumerated = array();
$values = array_values($array);
$keys = array_keys($array);
for($index = 0; $index < count($array); $index++)
{
$iteration;
for($iteration = 0; $iteration < $values[$index]; $iteration++)
{
$enumerated = array_merge($enumerated, array($keys[$index]));
}
}
return $enumerated;
}
?>
----
Server IP: 216.194.113.175
Probable Submitter: 67.169.134.159
----
Manual Page -- http://www.php.net/manual/en/function.array-count-values.php
Edit -- https://master.php.net/note/edit/72386
Del: integrated -- https://master.php.net/note/delete/72386/integrated
Del: useless -- https://master.php.net/note/delete/72386/useless
Del: bad code -- https://master.php.net/note/delete/72386/bad+code
Del: spam -- https://master.php.net/note/delete/72386/spam
Del: non-english -- https://master.php.net/note/delete/72386/non-english
Del: in docs -- https://master.php.net/note/delete/72386/in+docs
Del: other reasons-- https://master.php.net/note/delete/72386
Reject -- https://master.php.net/note/reject/72386
Search -- https://master.php.net/manage/user-notes.php