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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T05:54:12+00:00 2026-05-13T05:54:12+00:00

I am having a bit of trouble understanding this bug. Here is the code:

  • 0

I am having a bit of trouble understanding this bug.
Here is the code:

 function filter_optionsfordash(array $data,$dash) {
    $filtered_options = array();
    $len = strlen($dash);    
    foreach ($data as $k => $value) {
      if (substr($k,0,$len) === $dash) {
        $option_name = trim(str_replace($dash . '_','',$k)); 

        switch ($option_name) {
          case 'displayColumns':
            $value = explode(',',$value);
          break;

          case 'dashletTitle':
            $option_name = 'title';
          break;

          case 'id':
          case 'module':
          case 'action':
          case 'configure':
          case 'to_pdf':
            continue;
          break;
        }


        $filtered_options[$option_name] = $value;         
      }
    }    

    return $filtered_options;
  }

What I am trying to do here is to filter some values from the give array (in this case it will be the $_POST) which start with the given name ($dash), but I want to filter out the ones that are ‘id’, ‘module’, ‘action’, ‘configure’ or ‘to_pdf’.

So what I thought would work is a ‘continue’. Since the switch statement isn’t a loop, ‘continue’ should go to the start of the loop (the foreach), but apparently this doesn’t happen. I am still getting the key names I don’t want in the array.

I have found a solution, by changing the code a bit, but I would really like to understand why this doesn’t work.

The ‘continue’ should send me back to the foreach!!

  • 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-13T05:54:12+00:00Added an answer on May 13, 2026 at 5:54 am

    http://docs.php.net/continue says:

    continue is used within looping structures to skip the rest of the current loop iteration […]
    Note: Note that in PHP the switch statement is considered a looping structure for the purposes of continue.

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

Sidebar

Ask A Question

Stats

  • Questions 328k
  • Answers 328k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer C++ doesn't have a concept of "primitive" types; integers are… May 14, 2026 at 2:04 am
  • Editorial Team
    Editorial Team added an answer How about len(set(a)) - len(c)? Edit: len(a) could be incorrect… May 14, 2026 at 2:04 am
  • Editorial Team
    Editorial Team added an answer How about storing the rectangle's four corners (x0, y0, x1,… May 14, 2026 at 2:04 am

Related Questions

I am reasonably new to C# as a language (coming from a C++ background)
I am currently exploring the specification of the Digital Mars D language, and am
I have trouble understanding the gcc compiler provided by OSX 10.6 snow leopard, mainly
recently I have been trying my hand at coding a game in C#. I'm
See Also: understanding events and event handlers in C# As a web dev, I

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.