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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:56:01+00:00 2026-05-24T17:56:01+00:00

I have to execute multiple set of instructions based upon a value, for example.

  • 0

I have to execute multiple set of instructions based upon a value, for example.

$value = 'AA';
switch ($value) {
    case 'AA':
        echo "value equals  1";
    continue;
    case 'BB':
        echo "value equals 2";
    continue;
    case 'CC' || 'AA':
        echo "value equals 3";
    break;
}

What i am expecting from the above code is it should execute multiple cases based upon the values passed, the variable $value contains AA as the value so hence i am expecting it to execute both

case 'AA' and
case 'CC' || 'AA'

so it should print out value equals 1 value equals 3 however it does not execute it that way i am getting only value equals 1 as output. and if i remove continue from the statement it executes all three cases which is logically wrong. does the PHP’s switch statement support multiple cases to be executed based on a single value? is there any workaround for this?

thank you..

  • 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-24T17:56:02+00:00Added an answer on May 24, 2026 at 5:56 pm

    When a break is missing then a switch statement enables falling through to the next condition:

    $value = 'AA';
    switch ($value) {
        case 'AA':
            echo "value equals  1"; // this case has no break, enables fallthrough
        case 'CC':
            echo "value equals 3"; // this one executes for both AA and CC
        break;
        case 'BB':
            echo "value equals 2";
        break;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a stored procedure that returns multiple tables. How can I execute and
I have multiple UIViews, UIButtons etc. and would like to execute some specific code
Which command will executed first,If a stored procedure have individual multiple select commands;
I have a repeatable business process that I execute every week as part of
I have a Python script that needs to execute an external program, but for
I have a read query that I execute within a transaction so that I
I have an interface method public void Execute(ICommand command); which needs to pass known
I have a flex application that needs the ability to generate and execute JavaScript.
I have a large CSV file and I want to execute a stored procedure
I have a .bat and inside the .bat i would like to execute a

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.