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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T11:02:57+00:00 2026-05-12T11:02:57+00:00

If car or ferrari as an input, it should print car or ferrari. How

  • 0

If “car” or “ferrari” as an input, it should print “car or ferrari”. How can I achieve it?

<?php
$car ='333';
switch($car)
{

        case car OR ferrari:
                print("car or ferrari");
                break;
        case cat:
                print("cat");
                break;
        default:
                print("default");
                break;
}
?>
  • 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-12T11:02:58+00:00Added an answer on May 12, 2026 at 11:02 am

    Use two case clauses:

    case 'car':
    case 'ferrari':
        print("car or ferrari");
        break;
    

    The explanation:

    It is important to understand how the switch statement is executed in order to avoid mistakes. The switch statement executes line by line (actually, statement by statement). In the beginning, no code is executed. Only when a case statement is found with a value that matches the value of the switch expression does PHP begin to execute the statements. PHP continues to execute the statements until the end of the switch block, or the first time it sees a break statement. If you don’t write a break statement at the end of a case’s statement list, PHP will go on executing the statements of the following case.

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

Sidebar

Related Questions

One car must have one owner, and an owner can have many cars.
model Sample has attributes car,bike x =bike y = Sample.new How can I do?
For example, In a 'Car' table you have 'Ferrari' appearing 4 times. And 'Lamborghini'
1 question type $transport = array('foot', 'bike', 'car', 'plane'); can i delete the plane
Regarding this code: var name = Jaguar; var car = { name:Ferrari, getName:function(){ return
id car make sales 1 panamera porsche 100 2 italia ferrari 200 3 volante
for car in Car.query().fetch(): print car.owner == users.get_current_user() This prints True for all cars
My Table structure is given below id user_name item brand 1 A car ferrari
Here I have the xml: <root> <field ...>offer</field> <field type=ferrari ...>car</field> <field ...>company</field> <field
Is it possible to change given XML structure <Cars> <Car>Honda</Car> <Car>Ferrari</Car> </Cars> with XLST

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.