Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rearrange array keys php

i have this array:

Array
(
[15] =>     13.1

[16] =>     Mark one answer

[19] => You see a car on the hard shoulder of a motorway with a HELP pennant displayed. This means the driver is most likely to be

[20] => a disabled person first aid trained

[21] => a foreign visitor

[22] => a rescue patrol person

[25] => DES s15, HC r278);

How do i get it to sort the keys from 0? to get this: i know there is a function, but my head is burned, the sort function doesn't fit my needs since they rearrange values, and i need them to be conserved.

 Array
(
[0] =>  13.1

[1] =>  Mark one answer

[2] => You see a car on the hard shoulder of a motorway with a HELP pennant displayed. This means the driver is most likely to be

[3] => a disabled person first aid trained

[4] => a foreign visitor

[5] => a rescue patrol person

[6] => DES s15, HC r278);
like image 598
Sebastian Avatar asked Jan 10 '12 02:01

Sebastian


1 Answers

I think you're looking for array_values

$arr = array_values($arr);

like image 127
Ben Avatar answered Oct 16 '22 06:10

Ben