OM The Eternity
OM The Eternity

Reputation: 16204

How to rearrange the array element from 0th index in the sequence to end?

How to rearrange the array element from 0th index in the sequence to end in PHP?

UPDATED

I have an array:

$input =array{ 
                              2 => '13234390',
                              4 => '12345290',
                              5 => '21322210' 
                              }

now I want this array to be rearranged as

$input =array{ 
                              0 => '13234390',
                              1 => '12345290',
                              2 => '21322210' 
                              }

Upvotes: 4

Views: 14109

Answers (1)

Gordon
Gordon

Reputation: 316969

With

  • array_values() returns all the values from the input array and indexes numerically the array.

Example:

$array = array_values($input);

Upvotes: 13

Related Questions