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 9139303
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:22:12+00:00 2026-06-17T09:22:12+00:00

I try to create a list with nested foreach loop. First loop is looping

  • 0

I try to create a list with nested foreach loop. First loop is looping some numbers, second loop is looping dates. I want to write one number to one date. So there is a another function to check that. But the result is numbers writes on dates multiple times.

Out is something like that :

number 5 is on 2013.01.15;
number 5 is on 2013.01.16;
number 5 is on 2013.01.17;
number 6 is on 2013.01.15;
number 6 is on 2013.01.17;

The code :

function create_event($numbers,$available_dates) {
  foreach($numbers as $number) {
    foreach($avaliable_dates as $av_date) {

      $date_check= dateCheck($av_date,$number);

      if ($date_check == 0) {
        echo "number ".$number." is on ".$av_date;
        break;
      } else {
        $send_again[] = $number;
      }

    }
  }
  create_event($send_again,$avaliable_dates);
}

I think inside loop is not break.

  • 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-06-17T09:22:12+00:00Added an answer on June 17, 2026 at 9:22 am

    Can you check something like this:

    function create_event($numbers,$available_dates) {
        foreach ($numbers as $number) {
            foreach ($available_dates as &$av_date) {
                if (dateCheck($av_date, $number) == 0) {
                    unset($av_date);
                    break;
                }
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I try to create a list from the facts: mother(jane,jerry). mother(susan,riche). mother(helen,kuyt). I want
I'm try to create a new list object. I set the new object to
I want to try create something like Zend's Server Pagecache. What I want to
I try to create styles with first-child and last-child items but I encountered a
I want to create list with object like i.e. for every object there is
I am trying to create a new list via a list comprehension but want
[SOLVED] So I decided to try and create a sorted doubly linked skip list...
I want to create list of years in array like this: array ( '2011'
following problem: Having a base triple (0,1,0) Now I try to create a list
I try to create a working json-object structure to create a defintion list. see

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.