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

  • Home
  • SEARCH
  • 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 7173707
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:52:50+00:00 2026-05-28T15:52:50+00:00

I am looping between 2 times in 10 minute intervals, which works fine and

  • 0

I am looping between 2 times in 10 minute intervals, which works fine and outputs a time like so:

<?=$time->format('H:i')?>

I then am pulling data from the database of times I then want to see if the data in the loop matches whats coming out of the database. I have created a method to get me all the records from the database and outputs them into an array. I then wanted to use in_array to match them up then run the value through another method to get data about it. Problem is that it doesnt match up, problem being:

if (array_search($time->format('H:i'), $bookings))
echo "Match";

$booking is a multi-dimension array looking like:

Array ( 
[0] => Array ( [id] => 1 [time] => 12:00 ) 
[1] => Array ( [id] => 2 [time] => 15:00 )
...
)

Thanks in advance!

  • 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-28T15:52:51+00:00Added an answer on May 28, 2026 at 3:52 pm

    It would be much easier if you get the values directly from database. still if you want to process it in php, you can try with array_walk(). I am not sure about the syntax but should be something like

    function search($value, $key, $needle)
    {
        array_search($needle, $value);
    }
    
    array_walk($bookings, 'search', $time->format('H:i'));
    

    where $value will be your inner arrays.
    Guys, please correct me if i am wrong with the syntax

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Looking into selector performance between $('#ID1, #ID2, #ID3') vs $('1X CLASS'). Which is faster?
Given a BPM (beats per minute) MIDI delta time (leftmost bit off) with speed
I want to calculate how much time elapsed between a datetime and now in
I would like to measure how much time a user spends on my website.
Consider a data entry form where the user needs to enter times in military
I am using an API (Let's pretend its facebook) to gather data between two
I have a rather simple web-service which exposes data from sql server. It will
I've got to write a loop that should start and end between two times.
I have to compare data between two table and check for any conflicts. Below
I have developed an app which works alot with dates and also stores these

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.