note 71978 added to function.array
| From: | jeswanth at gmail dot com | Date: | Wed, 27 Dec 2006 14:12:21 +0000 |
| Subject: | note 71978 added to function.array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-120955@lists.php.net to get a copy of this message | ||
Hi all,
I thought this small piece of code can help you in your coding. If you ever deleted an element in an
array and want to re-construct the array and want to have the keys in series ie from starting 0 till
end, use array_values.
$temp=array('1', 3 => '2', 4 => '3');
print_r($temp);
$temp=array_values($temp);
print_r($temp);
Hope this helps :)
----
Server IP: 203.199.114.50
Probable Submitter: 202.65.136.2
----
Manual Page -- http://www.php.net/manual/en/function.array.php
Edit -- https://master.php.net/note/edit/71978
Del: integrated -- https://master.php.net/note/delete/71978/integrated
Del: useless -- https://master.php.net/note/delete/71978/useless
Del: bad code -- https://master.php.net/note/delete/71978/bad+code
Del: spam -- https://master.php.net/note/delete/71978/spam
Del: non-english -- https://master.php.net/note/delete/71978/non-english
Del: in docs -- https://master.php.net/note/delete/71978/in+docs
Del: other reasons-- https://master.php.net/note/delete/71978
Reject -- https://master.php.net/note/reject/71978
Search -- https://master.php.net/manage/user-notes.php