Course Title: Web Development Masterclass
Course Link: http://youaccel.com/admin/cdisplay.ph...
Facebook: / youaccel
Twitter: / youaccel
Website: http://youaccel.com
Tutorial Content:
In this lesson we will be exploring conditional statements. When writing code, we often want an action to occur, based on an event or condition.
In PHP we have different types of conditional statements, including:
if statements
if-else stements
if-else-elseif statements
switch statements
We will start with an example of a basic if statement.
Here, we have a variable x, set to a value of 49.
We have created an if statement with one condition. If the value of x is less than 50 - we want to output the words "Condition Met".
Since 49 is less than 50, we can see in our web browser that the words were outputted.
Now, what would happen if the condition was not met. Let's say we set x to 51. In this case 51 is not less than 50 - so there is no output in our web browser.
There is no output because we have not instructed our script on how to handle this condition.
To do so, we can add an else statement.
Let's create an else statement that outputs the words "Condition Not Met" if x is not less than 50.
So let's recap what we have done here.
As seen in our web browser the correct line is outputted.
You can change the value of x to test different results.
На этой странице сайта вы можете посмотреть видео онлайн PHP Conditional Statements | Tutorial длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь YouAccel 09 Май 2019, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели раз и оно понравилось 0 зрителям. Приятного просмотра!