note 41914 added to function.array-keys

From: Date: Mon, 26 Apr 2004 03:44:22 +0000
Subject: note 41914 added to function.array-keys
Groups: php.notes 
Request: Send a blank email to php-notes+get-68809@lists.php.net to get a copy of this message
Heh... I'm slapping my forehead for this one, but just in case it gets anyone else... You don't just run the function on an array and then expect that array to be re-indexed. For some reason I was expecting this to happen even though I've been working with PHP for several years (This is the first time I've had to use this function). What you need to do is assign it to a new variable which then becomse the re-indexed array. eg: $new_array = array_values( $old_array ); :) ---- Manual Page -- http://www.php.net/manual/en/function.array-keys.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+41914 Delete -- http://master.php.net/manage/user-notes.php?action=delete+41914&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+41914&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#68809) next »