note 49910 added to function.count
| From: | info at thebase dot be | Date: | Fri, 11 Feb 2005 20:31:02 +0000 |
| Subject: | note 49910 added to function.count | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-84867@lists.php.net to get a copy of this message | ||
I needed a fuction to reorder arrays, didnt found any so wrote one of my own... here's the
result:
<?php
$rry[48] = "mm";
$rry[50] = "aargh";
function ARRAY_REORDER($arry)
{
$a_count = count($arry);
$num = 0;
$b_count = 0;
while($b_count < $a_count):
if(isset($arry[$num])):
$new_arry[$b_count] = $arry[$num];
$b_count++;
endif;
$num++;
endwhile;
return($new_arry);
}
$new_arry = ARRAY_REORDER($rry);
print_r($rry);
print_r($new_arry);
?>
Gives the following output:
Array
(
[48] => mm
[50] => aargh
)
Array
( [0] => mm
[1] => aargh
)
----
Manual Page -- http://www.php.net/manual/en/function.count.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+49910
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+49910&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+49910&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+49910&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+49910&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+49910&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+49910&report=yes
Search -- http://master.php.net/manage/user-notes.php