While | Do While | For | Foreach | Loop in php is used to execute until provided expression is true.
In PHP, four type of loop available.
1. WHILE Loop
2. DO WHILE Loop
3. FOR Loop
4. FOREACH Loop
if else statements are very basic blocks to check condition(boolean expression) to execute appropriate block.
IF ELSE STATEMENTS :
SYNTAX:
if (booleanExpression) {
// if booleanExpression is True this code will execute
your code here….
} else {
// if booleanExpression is False this code will execute
your code here….
}
Array is a collection of similar types of datatype.
Array is used to stores multiple values in one place.
Array contains key => value pair, each value in array assigned on a key (index).
We can fetch stored value with the use of key (index).
A string is a sequence or series of characters, numbers, symbols in php.
Characters comes inside single quotes or double quotes treat as string.
We can create string by enclosing characters inside single / double quotation mark.
Variable in PHP is used to store a value in memory.
We can store integer, strings, characters, decimals in memory by using variables in PHP.
As a beginner, who want to learn PHP . One of the main question is how to create your first php program and how to run it. Php is a server side language so need a server to run php programs.
In this blog we are using wamp server for php programs to run. Install Wamp Server and create a Hello World program and run it.