0

我正在使用 php 从 plist 文件中解析到Array,下面是var_dump数组的

array (size=4)
0 => 
array (size=6)
  'EventId' => string 'Event1-2013-10-22' (length=17)
  'EventName' => string 'Event1' (length=6)
  'EventDate' => string '2013-10-21' (length=10)
  'EventDetails' => string ' ' (length=1)
  'Field1' => string 'Testing' (length=7)
  'Field2' => string '' (length=0)
1 => 
array (size=6)
  'EventId' => string 'Event2-2013-10-24' (length=17)
  'EventName' => string 'Event2' (length=6)
  'EventDate' => string '2013-10-24' (length=10)
  'EventDetails' => string ' EVe2' (length=5)
  'Field1' => string 'Testing22' (length=9)
  'Field2' => string '' (length=0)

我需要删除array (size=4),所以我只得到如下,需要帮助。

0 => 
array (size=6)
  'EventId' => string 'Event1-2013-10-22' (length=17)
  'EventName' => string 'Event1' (length=6)
  'EventDate' => string '2013-10-21' (length=10)
  'EventDetails' => string ' ' (length=1)
  'Field1' => string 'Testing' (length=7)
  'Field2' => string '' (length=0)
1 => 
array (size=6)
  'EventId' => string 'Event2-2013-10-24' (length=17)
  'EventName' => string 'Event2' (length=6)
  'EventDate' => string '2013-10-24' (length=10)
  'EventDetails' => string ' EVe2' (length=5)
  'Field1' => string 'Testing22' (length=9)
  'Field2' => string '' (length=0)
4

2 回答 2

1

您可以尝试使用 var_dump 对初始数组的内容使用 foreach 循环:

foreach ($initial_array as $second_array){
var_dump($second_array);
}
于 2013-10-29T09:22:53.820 回答
0

您可以使用reset() 函数来删除外部数组。

例如:

<?php
$outer_array = array(0 => array(
                            'key1' => 'value1',
                            'key2' => 'value2'
 ));

$new_array = reset($outer_array);
print_r($new_array);
?>
于 2013-10-29T09:48:43.647 回答