-2
Array
(
    [7] => 1449720000
    [6] => 1449741600
    [9] => 1449979200
    [8] => 1450000800
    [0] => 1450065600
    [1] => 1450087200
    [2] => 1450152000
    [3] => 1450173600
    [4] => 1450238400
    [5] => 1450260000
    [17] => 1450324800
    [16] => 1450346400
    [18] => 1450584000
    [19] => 1450605600
    [10] => 1450670400
    [11] => 1450692000
    [12] => 1450756800
    [13] => 1450778400
    [14] => 1450843200
    [15] => 1450864800
)

I did an asort, but how do I reassign the elements so that the first element after sort will be element 0

Manga Black
  • 193
  • 2
  • 9

1 Answers1

0

use array_values() for this,

$arr = array_values($array);

See demo here

Niranjan N Raju
  • 11,924
  • 3
  • 21
  • 41