14: Switch Statements in PHP | PHP Tutorial | Learn PHP Programming | PHP for Beginners

Switch Statements in PHP | PHP Tutorial | Learn PHP Programming | PHP for Beginners. In this PHP tutorial you will learn about the PHP switch statement. The switch statement works in a similar fashion as the if, else, elseif statements. In the switch statement we ask our code to execute specific code depending on the data we set inside the switch condition.

➤ GET ACCESS TO MY LESSON MATERIAL HERE!

First of all, thank you for all the support you have given me!

I am really glad to have such an awesome community on my channel. It motivates me to continue creating and uploading content! So thank you!

I am now using Patreon to share improved and updated lesson material, and for a small fee you can access all the material. I have worked hard, and done my best to help you understand what I teach.

I hope you will find it helpful :)

Material for this lesson: https://www.patreon.com/posts/php-14-download-15609633

Comments

Xiao Yang says:

Watched Javascript series first, but I’d say if I watched PHP sessions first, it’s easier to understand the Javascript sessions. But all of the sessions are still super awesome!!

Michael H. Armstrong says:

Are these used anywhere? I have never seen anyone use these. If so, when would you use this instead of an in statement?

Aaron Carillo says:

wow php is getting easier

MoVine says:

You are legend vote for Obama

Asit Kumar says:

Create a Small Game

< !DOCTYPE html>


Php Small Game For beginner

< ?php echo "Hello Welcome to Php Game." ?>

Enter a no Between 1 to 10


< ?php $get = $_GET['number']; switch ($get) { case '1': echo "You win This Game"; break; case '2': echo "You lost This Game"; break; case '3': echo "You hate Game"; break; case '4': echo "You love this Game"; break; case '5': echo "You have doubt about this Game"; break; case '6': echo "You are crazy for this Game"; break; case '7': echo "You lost Game"; break; case '8': echo "You are happy for Game"; break; case '9': echo "You don't want this Game"; break; case '10': echo "You win This Game"; break; default: echo "Try Again no match"; break; } ?>


Clockwerk Clockwerk says:

php is kinda like c++

piano0011 Lee says:

Thanks for the tutorial but I am still confused when to use switch and if statement… I have a piano website where the user can select more than 1 services. They can choose up to 3 services but I find it hard to use the if statement to add the fees but easier to do this with the switch statement….

Alessio Spampani says:

For codes clarity you should write the “break” immediately under the “echo” and not at the same indentation of the “case”. Apart of this, your tutorials are very professional. Thx for sharing your knowledge.

Eleasar Rebajado says:

thank god you have a great talent skills like that and you share it for those who want to be like you in the future

Muhammad Shoaib says:

Daniel, i can’t believe you have taught me php within a day, you are wonderful.

Via JS says:

your voice very sexy , thanks my teacher . u can do it for php language very esay,

Write a comment

*

Human Verification: In order to verify that you are a human and not a spam bot, please enter the answer into the following box below based on the instructions contained in the graphic.


Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!

Send this to a friend

▷ Other ReviewsVehicles   Show Cars   Motorbikes   Scooters   Bicycles   Rims & Tires   Luxury BoatsFashion   Sunglasses   Luxury Watches   Luxury Purses   Jeans Wear   High Heels   Kinis Swimwear   Perfumes   Jewellery   Cosmetics   Shaving Helpers   Fashion Hats   Modeling TipsFooding   Chef Club   Fooding Helpers   Coktails & LiquorsSports   Sport Shoes   Fitness & Detox   Golf Gear   Racquets   Hiking & Trek Gear   Diving Equipment   Ski Gear   Snowboards   Surf Boards   Rollers & SkatesEntertainment   DIY Guides   Zik Instruments   Published Books   Music Albums   Cine Movies   Trading Helpers   Make Money   Fishing Equipment   Paintball Supplies   Trading Card Games   Telescopes   Knives   Vapes   GameplaysHigh Tech   Flat Screens   Tech Devices   Camera Lenses   Audio HiFi   Printers   USB Devices   PC Hardware   Network Gear   Cloud Servers   Software Helpers   Programmer Helpers   Mobile Apps   Hearing AidsHome   Home Furniture   Home Appliances   Tools Workshop   Beddings   Floor Layings   Barbecues   Aquarium Gear   Safe Boxes   Office Supplies   Security Locks   Cleaning ProductsKids   Baby Strollers   Child Car Seats   Remote ControlledTravel   Luggages & Bags   Airlines Seats   Hotel Rooms   Fun Trips   Cruise Ships   Mexico Tours