LESSON 5 Flashcards
helps a program decide which route to take based on how the condition is evaluated.
You can create test conditions in the form of expressions that evaluates to either
true or false and based on these results you can perform certain actions.
CONDITIONAL STATEMENTS
TYPES OF CONDITIONAL STATEMENTS
1) if statement
2) if…else statement
3) if…elseif…else statement
4) switch statement
executes some code if one condition is true.
1) if statement
executes some code if a condition is true and another code if that condition is
false.
2) if…else statement
executes different codes for more than two conditions.
3) if…elseif…else statement
selects one of many blocks of code to be executed
4) switch statement
In computer Programming, a Loop is used to execute a group of instructions or a
block of code multiple times, without writing it repeatedly. The loop continues as
long as the specified condition is true.
LOOPING STATEMENT
TYPES OF LOOPING STATEMENTS
1) while
2) do…while
3) for
4) foreach
loops through a block of code as long as the specified condition is true
1) while
loops through a block of code once, and then repeats the loop as long as the
specified condition is true
2) do…while
loops through a block of code a specified number of times
3) for
loops through a block of code for each element in an array
4) foreach
function is used to calculate the number of characters inside a string. It
also includes the blank spaces inside the string.
strlen()
function counts the number of words in string.
str_word_count()
replaces all occurrences of the search text within the target string.
str_replace()