0

I have following array with keys 0,1,2,3,4

Array
(
[media_list] => Array
    (
        [0] => Array
            (
                [media_id] => c36ca1a05136461ba3642f943b3ac447
                [title] => Eat This: Best of 2015 31 DEC
                [description] => Enjoy this week's Eat This episode, 
                [thumbnail_url] => zbr.120x66.jpeg
                [duration] => 239867
            )

        [1] => Array
            (
                [media_id] => 3b9179b13a7943f0818e82ff7970a8ba
                [title] => Eat This: Encore - Crossroads Bake Shop
                [description] => Chuck visits the Crossroads Bake Shop 
                [thumbnail_url] => ZMw.120x66.jpeg
                [duration] => 253367
            )

        [2] => Array
            (
                [media_id] => e2f440d4a6314027b967f414e6692204
                [title] => Eat This:Robin's Nest
                [description] => 
                [thumbnail_url] => 84-.120x66.jpeg
                [duration] => 312733
            )

        [3] => Array
            (
                [media_id] => 0fb7fff38ced4dfc8061bf1528902384
                [title] => Eat This: Weinrich's Bakery
                [description] => The Philadelphia area is known for buttercakes,
                [thumbnail_url] => 0P_.120x66.jpeg
                [duration] => 274133
            )

        [4] => Array
            (
                [media_id] => 76ac830d33f34a7c97c725e341246376
                [title] => Encore - Eat This: Heritage Turkeys
                [description] => Eat This stops by Longview Farm Market in Collegeville to see
                [thumbnail_url] => 83x.120x66.jpeg
                [duration] => 262633
            )

       )

)

If i removed(unset) any of key from this array(say i removed key 0) then array look like-

Array
(
     [1] => Array
        (
            [media_id] => 3b9179b13a7943f0818e82ff7970a8ba
            [title] => Eat This: Encore - Crossroads Bake Shop
            [description] => Chuck visits the Crossroads Bake Shop 
            [thumbnail_url] => ZMw.120x66.jpeg
            [duration] => 253367
        )
    [2] => Array
        (
        [media_id] => e2f440d4a6314027b967f414e6692204
        [title] => Eat This:Robin's Nest
        [description] => 
        [thumbnail_url] => 120x66.jpeg
        [duration] => 312733
    )

[3] => Array
    (
        [media_id] => 0fb7fff38ced4dfc8061bf1528902384
        [title] => Eat This: Weinrich's Bakery
        [description] => The Philadelphia area is known for   buttercakes
        [thumbnail_url] => P_.120x66.jpeg
        [duration] => 274133
    )

[4] => Array
    (
        [media_id] => 76ac830d33f34a7c97c725e341246376
        [title] => Encore - Eat This: Heritage Turkeys
        [description] => Eat This stops by Longview Farm Market in     Collegeville to see how their resident
            [thumbnail_url] => 83x.120x66.jpeg
            [duration] => 262633
    )
)

)

Array keys changed 1,2,3,4 from 0,1,2,3,4 I want my array keys start from 0,1,3,4,5, and so on.

1

1 Answer 1

1
$array = array_values($array);
Sign up to request clarification or add additional context in comments.

1 Comment

Oh !!! thank you so much it solved my problem

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.