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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T01:58:18+00:00 2026-06-15T01:58:18+00:00

This code snippet is just a small part of a larger php file. Currently,

  • 0

This code snippet is just a small part of a larger php file. Currently, the file produces nothing when run (as befits PHP) but when I comment out this section (below), the file executes. Thus, I’m left to believe that something in this code snippet is keeping the PHP from running correctly. Perhaps is it the nested switch-statements?

switch($interval)
{
    case "week":

        $active_date = date('N', $endTime);

        switch($active_date)
        {
            case 1:
                $categories = ["Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday","Monday"];
                break;
            case 2:
                $categories = ["Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"];
                break;
            case 3:
                $categories = ["Thursday","Friday","Saturday","Sunday","Monday","Tuesday","Wednesday"];
                break;
            case 4:
                $categories = ["Friday","Saturday","Sunday","Monday","Tuesday","Wednesday","Thursday"];
                break;
            case 5:
                $categories = ["Saturday","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday"];
                break;
            case 6:
                $categories = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];
                break;
            case 7:
                $categories = ["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"];
                break;
        }
        break;
    case "month":
        $categories = ["Three Weeks Ago","Two Weeks Ago","Last Week","This Week"];
        break;
    case "year":

        $active_date = date('n', $endTime);

        switch($active_date)
        {
            case 1:
                $categories = ["February","March","April","May","June","July","August","September","October","November","December","January"];
                break;
            case 2:
                $categories = ["March","April","May","June","July","August","September","October","November","December","January","February"];
                break;
            case 3:
                $categories = ["April","May","June","July","August","September","October","November","December","January","February","March"];
                break;
            case 4:
                $categories = ["May","June","July","August","September","October","November","December","January","February","March","April"];
                break;
            case 5:
                $categories = ["June","July","August","September","October","November","December","January","February","March","April","May"];
                break;
            case 6:
                $categories = ["July","August","September","October","November","December","January","February","March","April","May","June"];
                break;
            case 7:
                $categories = ["August","September","October","November","December","January","February","March","April","May","June","July"];
                break;
            case 8:
                $categories = ["September","October","November","December","January","February","March","April","May","June","July","August"];
                break;
            case 9:
                $categories = ["October","November","December","January","February","March","April","May","June","July","August","September"];
                break;
            case 10:
                $categories = ["November","December","January","February","March","April","May","June","July","August","September","October"];
                break;
            case 11:
                $categories = ["December","January","February","March","April","May","June","July","August","September","October","November"];
                break;
            case 12:
                $categories = ["January","February","March","April","May","June","July","August","September","October","November","December"];
                break;
        }
        break;
}

any idea what is incorrect about this?

  • 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-15T01:58:20+00:00Added an answer on June 15, 2026 at 1:58 am

    Thanks for the responses, I was hinted to try using the array() syntax instead of the [ ] syntax and that appears to have the code working. So I’ll assume that as a solution for now.

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

Sidebar

Related Questions

I think this question is best asked with a small code snippet I just
I have this small snippet of python code that I wrote. It works, but
VS 2008 I have this code snippet I found on a VB website. But
Perhaps I'm over-simplifying this by only giving you a small snippet of code (and
This code snippet is from C# in Depth static bool AreReferencesEqual<T>(T first, T second)
Take this code snippet for example: window.location.href = 'mysite.htm#images'; Already being on the site
I'm looking at this code snippet: var addSnippet = function( req, res ) {
I found this code snippet to retrieve the title from a YouTube video and
I have this code snippet: $(function() { $('.toolbar [id^=button]').on('click', function () { $(this) .css('background-color',
I have this code snippet: <div id=div1> </div> <div id=div2> <h3>This is the content</h3>

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.