O
O
Optimus2015-12-21 10:35:10
PHP
Optimus, 2015-12-21 10:35:10

How to reset an array key?

Here is an array sorted by the natsort function, the values ​​are sorted in natural order.

[0]=>     string(8) "file_1"
  [1111]=>  string(8) "file_2"
  [2222]=>  string(8) "file_3"
  [3333]=>  string(8) "file_4"
  [4444]=>  string(8) "file_5"
  [5554]=>  string(8) "file_6"
  [6665]=>  string(8) "file_7"
  [7776]=>  string(8) "file_8"
  [8887]=>  string(8) "file_9"
  [1]=>     string(9) "file_10"

How now to reset the keys so that file_1 has a key of 0, file_2 has a key of 1, etc.?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene, 2015-12-21
Pyan @marrk2

array_values()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question