我有一個foreach
語法比較不同的項目,其產生以下結果:在不同陣列
array
0 =>
array
'value' => string '2012-05-09T12:00:00' (length=19)
'value2' => string '2012-05-09T15:00:00' (length=19)
'timezone' => string 'Europe/Paris' (length=12)
'timezone_db' => string 'UTC' (length=3)
'date_type' => string 'date' (length=4)
1 =>
array
'value' => string '2012-03-14T13:00:00' (length=19)
'value2' => string '2012-03-14T16:00:00' (length=19)
'timezone' => string 'Europe/Paris' (length=12)
'timezone_db' => string 'UTC' (length=3)
'date_type' => string 'date' (length=4)
2 =>
array
...
array
0 =>
array
'value' => string '2012-02-08T13:00:00' (length=19)
'value2' => string '2012-02-08T16:00:00' (length=19)
'timezone' => string 'Europe/Paris' (length=12)
'timezone_db' => string 'UTC' (length=3)
'date_type' => string 'date' (length=4)
1 =>
array
'value' => string '2012-03-14T13:00:00' (length=19)
'value2' => string '2012-03-14T16:00:00' (length=19)
'timezone' => string 'Europe/Paris' (length=12)
'timezone_db' => string 'UTC' (length=3)
'date_type' => string 'date' (length=4)
2 =>
array
...
的...
代表更大量的代碼,全部採用相同的結構。
這裏是php
代碼:
foreach ($result as $term) {
$node = node_load($term->nid);
$dates = $node->field_date['und'];
var_dump($dates);
}
目標是比較的結果,並檢查他們的任何不平等。那麼,我的目標是一個腳本,讓我從第一陣列和第二陣列$dates[0]['value']
比較$dates[0]['value']
...
我想所有的0
項目或全部1
項目組成新陣列後來檢查他們,但迄今沒有運氣。有人有另一個想法嗎?
謝謝你在解決這個謎題的過程中的耐心和毅力:) – Michiel 2012-03-12 16:01:50