Page 185 - CITS - Computer Software Application -TT
P. 185
COMPUTER SOFTWARE APPLICATION - CITS
8 Visibility: Bootstrap provides visibility utilities to control the visibility of elements at different breakpoints.
Classes like. visible-* and .invisible-* allow you to show or hide elements based on the screen size. This helps
in creating responsive designs where certain elements are displayed or hidden depending on the device’s
viewport size
PHP Conditional Events, Flow control and looping in PHP
PHP Conditional Events and Flow Control
Control structures in php are fundamental programming concepts that enable developers to write powerful and
efficient code. They allow the program to execute specific instructions based on certain conditions. There are
three primary types of control structures: selection, iteration, and sequence. The selection structure executes a
set of instructions if a specific condition is met. The iteration structure is used when a set of instructions needs to
be repeated multiple times based on a given condition. The sequence structure is used to execute instructions in
sequential order. These structures are essential to writing efficient and reliable code.
Introduction
Control structures in php are an essential part of any programming language, including PHP. They are used to
control the flow of a program by allowing the programmer to specify which statements should be executed under
certain conditions. Understanding control structures in PHP is crucial for any aspiring PHP developer, as they
form the backbone of many programming tasks.
Control structures in PHP are used to make decisions based on conditions, loop through a set of instructions
multiple times, and break out of a loop or switch statement. The most common control structures used in PHP are
if-else statements, loops such as for and while loops, and switch statements.
By using if-else statements, a programmer can check a certain condition and execute a block of code if the
condition is true or execute a different block of code if the condition is false. Loops allow a programmer to
repeat a set of instructions multiple times, either for a specified number of times or until a certain condition is
met. Switch statements provide an alternative to multiple if-else statements, allowing a programmer to check
multiple conditions with a single statement. Control structures are a vital part of any programming language, and
understanding them is essential for any PHP developer. By mastering the use of control structures, a programmer
can create more efficient and effective PHP code, leading to better software applications.
Conditional statements
Conditional statements are used to perform different actions based on different conditions.
PHP Conditional Statements
Very often when you write code, you want to perform different actions for different conditions. You can use
conditional statements in your code to do this.
In PHP we have the following conditional statements:
• if statement - executes some code if one condition is true
• if...else statement - executes some code if a condition is true and another code if that condition is false
• if...elseif...else statement - executes different codes for more than two conditions
• switch statement - selects one of many blocks of code to be executed
PHP - The if Statement
172
CITS : IT&ITES - Computer Software Application - Lesson 47 - 62