Archive for May 16th, 2009

To reset the key values in a PHP array you can do this:
1234567891011121314151617181920212223$things = array(’a',’b',’c',’d');
unset($things[0]);
print_r($things);

#outputs
#Array
#(
#    [1] => b
#    [2] => c
#    [3] => d
#)

# Actually do the reset.
$things = array_values($things);

print_r($things);
#outputs
#Array
#(
#    [0] => b
#    [1] => c
#    [2] => d
#)


top