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.
En esta página del sitio puede ver el video en línea PHP Conditional Statements | Tutorial de Duración hora minuto segunda en buena calidad , que subió el usuario YouAccel 09 mayo 2019, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto veces y le gustó 0 a los espectadores. Disfruta viendo!