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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:15:16+00:00 2026-06-10T13:15:16+00:00

This is a relatively simple problem, but I would appreciate some insight into what

  • 0

This is a relatively simple problem, but I would appreciate some insight into what is going on to give me this error. Bellow is the code that is throwing the error:

    foreach($courseArray[0] as $value)
    {
        list( $courseQuarter,$coursePrefix ) = explode( "-", $value );
        if( $courseQuarter == get_current_yearquarter()) 
        {
                array_push( $return, $value );
        }
    }

The error specifically is from the list() line.

Here is a var_export() of $courseArray:

array ( 0 => array( 
          'count' => 15, 
          0 => '20103-0610-442-01', 
          1 => '20103-0508-446-01', 
          2 => '20103-0501-406-01', 
          3 => '20104-0660-499-01', 
          4 => '20111-0307-782-70', 
          5 => '20111-0610-870-01', 
          6 => '20111-0621-504-01', 
          7 => '20112-0621-513-01', 
          8 => '20112-0303-762-90', 
          9 => '20112-0101-794-71', 
          10 => '20112-0610-710-90', 
          11 => '20113-0307-770-70', 
          12 => '20113-0610-820-01', 
          13 => '20113-0617-631-01', 
          14 => '2121-0106-744-01', 
      ), 
);

Thank you for any help in fixing my code 🙂 I think I could use an explanation of offsets and how they relate to arrays.

  • 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-10T13:15:17+00:00Added an answer on June 10, 2026 at 1:15 pm

    it will foreach over the ‘count’ element, which doesn’t have a ‘-‘ in it.

    foreach($courseArray[0] as $key => $value)
    {
        if ($key == 'count') {continue;} // <- skip the 'count' key
        list( $courseQuarter,$coursePrefix ) = explode( "-", $value );
        if( $courseQuarter == get_current_yearquarter()) 
        {
                array_push( $return, $value );
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using this relatively simple code: var height = help ? 'minus' :
I am sure this is relatively simple, I just keep running into brick walls.
This is a relatively simple question, but I haven't been able to find a
This is probably a relatively simple oversight, but I can't work out if I'm
I just cannot figure this out, it looks really simple but I'm relatively new
This seems like it should be fairly simple, but for some reason I can't
I'm relatively new to scripting and apologize in advance for this painfully simple problem.
I know this must be relatively simple, but I have a dataset of JSON
I have this relatively simple regex for usernames // Enforce that username has to
I apologize for this seemingly relatively simple task that I can't figure out. I

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.