PHP For Loop
In every programming languages loops are applied where the repeated execution of a particular code is required until condition to be tested remains true. PHP For loop is identical to the for loop in C.
PHP Switch
The PHP switch is another conditional statement which carries out multiple condition check and execute the appropriate task based on the condition testing.
The PHP switch statement is a decent replacement of PHP if-elseif-else structure.In switch case structure only exact values can be compared i.e greater than or less than comparison is not present.
PHP if - else
Conditional statement is used where we have to take different decisions on different conditions.The PHP if-else conditional statement is very similar to the C.The PHP if-else conditional statement can be utilized in three ways.
- Using Only if using only if statement performs a single task only if the condition is true and does nothing if the condition goes false.
- Using if-else using if-else, if the condition is true the specified task is performed and if it is false the code in the else block will be executed.
- Using if-elseif-elseThis is the complete form of PHP if-else conditional statement where different conditions are tested and the action is performed accordingly.
PHP Sessions
Session is a way of keeping the user information on the server to recognize a particular user.The session information is a temporary arrangement of keeping the user data on the webserver which only lasts until the browser is not closed.
Sessions are implemented in a way that whenever a session is started a unique id (UID) is assigned to the user,this ID is than stored in a cookie or embedded in the URL.After that the $_SESSION array is used to hold different information based on that UID which was assigned to the user.