Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7634825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:16:49+00:00 2026-05-31T07:16:49+00:00

I have a foreach syntax which generates following outcome: array 0 => array ‘value’

  • 0

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 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T07:16:51+00:00Added an answer on May 31, 2026 at 7:16 am
    $array[] = array(
        'value'       => '2012-03-14T13:00:00',
        'value2'      => '2012-03-14T16:00:00',     // <--- Error
        'timezone'    => 'Europe/Paris',
        'timezone_db' => 'UTC',
        'date_type'   => 'date',
    );
    $array[] = array(
        'value'       => '2012-03-14T13:00:00a',     // <--- Error
        'value2'      => '2012-03-14T16:00:00', 
        'timezone'    => 'Europe/Paris',
        'timezone_db' => 'UTC',
        'date_type'   => 'date',
    );
    $array[] = array(
        'value'       => '2012-03-14T13:00:00',
        'value2'      => '2012-03-14T16:00:00tt',    // <--- Error
        'timezone'    => 'Europe/Paris',
        'timezone_db' => 'UTC',
        'date_type'   => 'date11',
    );
    
    $errors = array();
    for($i=0; $i < count($array)-1; $i++ ) 
        $errors = array_merge( array_diff_assoc($array[$i], $array[$i+1]) );
    
    var_dump($errors);  
    
    /* Output
     * ------
     * Array
     * (
     *     [value] => 2012-03-14T13:00:00a
     *     [value2] => 2012-03-14T16:00:00
     *     [date_type] => date
     * )
     */
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following foreach-loop: using System.IO; //... if (Directory.Exists(path)) { foreach(string strFile in Directory.GetFiles(path,
I have foreach function which calls specified function on every element which it contains.
I have a foreach which imports data to our CMS. Now I want to
i want to have a foreach loop where the initial array is changed inside
In Java 5 and above you have the foreach loop, which works magically on
I have a value in my span, which i want to compare with C#
I have the following piece of code, inside a php script foreach( $results as
I am trying to use the following code, which I have not been able
I have the following code: SqlDataReader reader = getAddressQuery.sqlReader; while (reader.Read()) { foreach (Object
Now that we have tremendous functionality thanks to LINQ, I'm wondering which syntax is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.