22

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);
0

1 Answer 1

63

I think you're looking for array_values

$arr = array_values($arr);

Sign up to request clarification or add additional context in comments.

1 Comment

It also looks like a trim was applied =) array_map('trim', ...) to the max.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.