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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T11:52:43+00:00 2026-05-22T11:52:43+00:00

Let say store open at 13:00 but customer can allow to make orders after

  • 0

Let say store open at 13:00 but customer can allow to make orders after 16:00 (standard time)

The if statement doesnt seem to work properly as expected, how to fix it?

Code:

if ((date('H:i') >= '16:00') && ($data[$key]['opentime'] >= '16:00')) {
    $data[$key]['open'] = 1;
} else {
    $data[$key]['open'] = 0;
}

Possible Opentime:

$data[$key]['opentime']
// Opentime = 12:30
// Opentime = 14:00
// Opentime = 16:00
// Opentime = 16:30
// Opentime = 17:00

Also customer can not make order after 23:30 but should check with $data[$key]['closetime'] (eg: 20:00, 21:00)

  • 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-22T11:52:44+00:00Added an answer on May 22, 2026 at 11:52 am

    PHP doesn’t know ’10:00′ is a time. To PHP, ’10:00′ is just text.

    It’s like asking PHP if ‘abcfg’ is larger than ‘jg’.

    If you know you’ll be dealing with hours only, simply use a number to represent an hour. Your code would look like:

    $h1 = (int) date('H');
    $h2 = (int) $data[$key]['opentime']; // anything after ':' is ignored
    if (($h1 >= 16) && ($h2 >= 16)) {
        $data[$key]['open'] = 1;
    } else {
        $data[$key]['open'] = 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I want to store a group of function pointers in a List<(*func)>
Let's say I want to design a REST store used to manage a list.
Let's say I want to bit shift i twice to the left and store
Let's say I have a RESTful, hypertext-driven service that models an ice cream store.
I would like to store only .txt filenames from a specific dir (let's say:
how should I store user data in asp.net mvc? Let's say a user want
I've got some financial data to store and manipulate. Let's say I have 2
I am wondering what would be the best approach to store, for let's say
Let say i have a text file with today is today but tomorrow is
Let's say I store bank accounts information in an immutable Map : val m

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.