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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T01:57:20+00:00 2026-06-07T01:57:20+00:00

Included below is a sample of the data found in the file 1.php :

  • 0

Included below is a sample of the data found in the file 1.php:

: [
    {
        "ID": "1",
        "active": "1",
        "wait": "30"
    },
    {
        "ID": "6",
        "active": "1",
        "wait": "10"
    },
    {
        "ID": "8",
        "active": "1",
        "wait": "65"
    }
]
}

This is my code so far, and I’m not getting very far so any help appreciated.

<?php
$url = "1.php";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec ($ch);
curl_close ($ch);  

if((date("H") < 9) || (date("H") > 24)) {
    echo "Closed";
} else {
    echo ($Queue_Time: <= 10) ? $data : $Queue_Time-5;
};
$result = json_decode ($json);
$arr = array(1, 2);

?>

Basically, I would like to display “ID”:”1″ as a name, such as “Meat” “ID”:”2″ “Cheese” etc. Then display a queue wait time which is the value of “wait” next to the name.
The shop is only open from 10am-5pm so outside of these hours I just want it to display the name and “Closed” next to it insead of the wait time.

Lastly if the wait time is greater than 10 mins, then I would like to deduct 5 mins from that value.

I am unable to get the code above to work as expected and would really appreciate a hand.

Many Thanks

  • 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-07T01:57:21+00:00Added an answer on June 7, 2026 at 1:57 am

    I’ve taken a few liberties in trying to get what you want, so let me know how close it is:

    // Assuming we have a correctly formatted JSON array from CURL
    $data = '[
        {
            "ID": "1",
            "active": "1",
            "wait": "30"
        },
        {
            "ID": "6",
            "active": "1",
            "wait": "10"
        },
        {
            "ID": "8",
            "active": "1",
            "wait": "65"
        }
    ]
    ';
    
    // This array maps IDs to Names
    $department[1] = 'Meat';
    $department[2] = 'Cheese';
    $department[6] = 'Fish';
    $department[8] = 'Vegetables';
    
    // Decode the JSON data
    $data = json_decode($data);
    
    // Loop through each area
    foreach ($data as $counter) {
        // Check if closed
        if((date("H") < 10) || (date("H") > 17)) {
            $queue = "Closed";
        } else {
            $queue = ($counter->wait <= 10) ? $counter->wait : $counter->wait-5;
        };
        // Output name and wait time
        echo $department[$counter->ID].' '.$queue.'<br />';
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting LNK2001 error. The code has been included below. Can someone please
I have a form to upload image like below <form name=sample enctype=multipart/form-data action=index.php method=post
I'd like to optimize the XSL transform below. I've included sample input data and
While running the code I've included below I receive the error EntityCommandExecutionException was unhandled
I'm developing a footer in an HTML file ( simplified, included below ). I
Below I've included my h file, and my problem is that the compiler is
I need to echo entire content of included file. I have tried the below:
Sorry for not included any example data for my problem. I couldn’t find a
I have data in two tables (see below for a sample) - how do
Consider the sample code below: #include <iostream> using namespace std; class A { private:

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.