2015-12-31 3 views
0

Я следующий массив с ключами 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 
      ) 

     ) 

) 

Если я удалил (отключенный) любой ключ из этого массива (скажем, я извлекал ключ 0), то внешний вид массива как-

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 
    ) 
) 

)

ключи массива изменились 1,2,3,4 из 0,1,2,3,4 Я хочу, чтобы мои ключи массива начинаются от 0,1,3,4, 5 и т. Д.

+2

http://stackoverflow.com/questions/5217721/how-to-remove-array-element-and-then-re-index-array –

ответ

1
$array = array_values($array); 
+2

О !!! Большое вам спасибо, я решил свою проблему –

Смежные вопросы