Page 1 of 1

Discard keys even numerics

Posted: Sat Dec 02, 2006 2:59 pm
by Ollie Saunders
I'm having a blonde day today. I always thought array_values did this but obviously not. Is there a single function call to discard all the keys and start index again from zero. What I want is this:

Code: Select all

$array = array(1 => 'a', 50 => 'b');
$this->assertIdentical(someFunc($array), array(0 => 'a', 1 => 'b'));

Posted: Sat Dec 02, 2006 3:02 pm
by feyd

Posted: Sat Dec 02, 2006 3:20 pm
by Ollie Saunders
OK..I need to trust my myself more and my code less :)
Turns out a bit of code supposed to be calling array_values actually wasn't.