I have a foreach syntax which generates following outcome:
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
...
The ... represent a lot more code, all with the same structure.
And here is the php code:
foreach ($result as $term) {
$node = node_load($term->nid);
$dates = $node->field_date['und'];
var_dump($dates);
}
Goal is to compare the results and check them for any inequalities. So what I’m aiming for is a script which allows me to compare $dates[0]['value'] from the first array and $dates[0]['value'] from the second array…
I was thinking of composing new arrays with all the 0 items or all the 1 items and later on check them, but so far no luck. Does anybody have another idea?
1 Answer