1

i have this array:

[2] => Array
    (
        [type] => jpg
        [name] => 25.jpg
    )

[3] => Array
    (
        [type] => jpg
        [name] => 26.jpg
    )

[8] => Array
    (
        [type] => jpg
        [name] => 27.jpg
    )

[13] => Array
    (
        [type] => jpg
        [name] => 10.jpg
    )

[14] => Array
    (
        [type] => jpg
        [name] => 11.jpg
    )

how i can change back the id to 0,1,2,3... etc? instead of 2,3,8,13,14?

2 Answers 2

8

Try array_values.

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

Comments

5

Assuming they're still well-ordered, and assuming your array is named $input:

$result = array_values($input);

Should work.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.