More About PHP Switch Statements, Fall Through Explained, Exclude Break in PHP Switch Statements

Channel:
Subscribers:
7,760
Published on ● Video Link: https://www.youtube.com/watch?v=dOj9NzIijZQ



Duration: 3:39
33 views
0


If you ever wondered why we add breaks to switch statements in PHP and other programming languages, then this video, More About PHP Switch Statements, Fall Through Explained, Exclude Break in PHP Switch Statements, will help in answering that. This PHP programming lesson is based on Codecademy's free programming course, Learn PHP, where we go over the PHP programming language. In the previous lesson, we looked at switch statements in PHP and how they basically work. In this lesson, we dive deeper into switch statements and learn more about the break keyword and when and why it is used. In this lesson, we learn that we are able to omit the break keyword when we don't want the switch statement to stop executing. Sometimes you might want multiple values to return something, and in this case, we can omit the break keyword and that first case will run as well as the following case if the break is not declared. For example, you might want the words, "Friday", "Saturday", or "Sunday" to all return, "Weekend". This would be done by having weekend at the bottom, and omitting the break starting with "Friday". If we did this we would be able to return weekend for all 3 choices, since the choice would fall through, until it reached a break or the end of the switch statement. Thanks for watching More About PHP Switch Statements, Fall Through Explained, Exclude Break in PHP Switch Statements.




Other Videos By We Will Code


2022-10-15Learn CSS Colors by Building a Set of Colored Markers, Free CSS Beginners Course freeCodeCamp 2023
2022-10-02Add Global Header and Footer, CSS and Admin Bar to Custom WordPress Theme, Explain Custom WP Theme
2022-09-27Learn PHP Ternary Operator, Using Ternary Operator with PHP, Ternary Operator Explained in PHP Code
2022-09-27Truthy and Falsy in PHP Programming 2023, Truth and False Conditions in Programming with PHP Code
2022-09-27Customize, Develop WordPress Theme from Scratch, Loop Through WP Posts and Pages, Get Post Content
2022-09-26What are Arrays in WordPress, How to Become a WordPress Developer 2023, WordPress Beginner Course
2022-09-23What are Functions in WordPress, Easy Intro to Functions, Using WordPress Functions, WP Functions
2022-09-22How to Create A Wordpress Theme 2023, Become a Wordpress Developer, Make Custom Theme in Wordpress
2022-09-22Become a Wordpress Developer 2023, What is PHP, Use PHP in Wordpress Explained, Run PHP in Wordpress
2022-09-21Become a Wordpress Developer in 2023, Where to Begin, Free Local Wordpress Environment Installation
2022-09-19More About PHP Switch Statements, Fall Through Explained, Exclude Break in PHP Switch Statements
2022-09-182022 New MacBook Pro, M2, 16GB Unified Memory, 512 SSD Unboxing, MacBook Apple Reveal 2022
2022-09-15PHP Switch Statements Explained, Understanding Switch Statement Conditional Logic in PHP Programming
2022-08-19How Elseif Statements Work in PHP, Elseif Statements Explained, How to use an Elseif Conditional
2022-07-18What are Comparison Operators in PHP Programming, How do Comparison Operators Work, PHP Programming
2022-07-16PHP Identical and Not Identical Operators, True, False, Not True Operators in PHP Programming Lesson
2022-07-10Learn about PHP Conditionals, What are If Statements in PHP, Intro to PHP Conditional Statements
2022-07-10Intro to Booleans and Comparison Operators in PHP, Learn PHP Comparison Operators and Booleans Free
2022-07-03Review HTML Form Handling, superglobals Explained, Name and Action Attribute Explained in PHP, Guide
2022-07-03Using the action Attribute with HTML Forms, Handling HTML Forms with PHP, Forms action Attribute
2022-06-27Learn POST Form Handling in PHP, POST Requests and HTML Form Handling, What is a Post Request in PHP



Tags:
Coding
Learn PHP
PHP
Programming
Server-side
back-end
code tutorial
tutorials