PHP For Loops

Instead of executing a task again and again, using loop is an efficient way of executing task in programming / Scripting world. FOR LOOP: For loop, as name says, looping a task until unless a condition is met. Syntax: for(initial value; condition; increment/decrement){ //execute required task  } To better understand the syntax, lets take one […]


In php, there may lots of situation rise where we need to check whether the condition is matching, if condition matches, then execute certain task otherwise don’t execute task. IF STATEMENT If statement is useful to check if a single condition matches, then execute a task. Syntax: if(condition){ } Note: Condition upon which, if statement […]

PHP Comparison Operators

PHP Comparison operators is used to perform comparison operations. There are various types of comparison operators available to perform various types of comparison. Lets discuss in detail. Equal Operator(==) Equal operator (==) is used to compare two values, and if both values are same, then it returns true otherwise it returns false. Example: <?php $num1=100; […]

PHP Decrement Operators

PHP Decrement operators helps to perform decrement operations. If we want to decrement value of a variable by 1 then we use decrement operator. There are two types of decrement operators: Pre-Decrement Operator (–a) Post-Decrement Operator (a–) Operator Function Example –a (Pre-Decrement operator) Decrements self first then assigns value a=1, b=–a, value of a=0, b=0 […]

PHP Increment Operators

Increment operators helps us to perform increment operations. If we want to increment value of a variable by 1 then we use increment operator. Increment operators are of two types: Pre-Increment operator Post-Increment Operator   Operator Function Example ++a (Pre-Increment operator) Increments self first then assigns value a=1, b=++a, value of a=2, b=2 a++ (Post-Increment operator) […]

PHP Assignment Operators

In this chapter, we are going to focus on assignment operators. What does Assignment Operator do? The job of assignment operator is to assign value to the variable. In general life, = (is equal to) compares the value (E.g price of chocolate is equal to $1 USD) but in programming world “=” is used to […]

PHP Arithmetic Operators

Alike any other programming language or scripting language, In PHP, we can also perform arithmetic operations. Arithmetic operations such as addition, multiplication, division, subtraction, modulus operation. Lets see one by one. Operation Operator Example Addition Addition Operator(+) Addition of 5 and 6=11 Subtraction Subtraction Operator(-) Subtraction of 10 and 5=5 Multiplication Multiplication Operator(*) Multiplication of […]

PHP – variable declaration

PHP is an easy server side scripting language. To accomplish various functionality and tasks, we require variables. PHP has its own of declaring variables. Lets see in detail. What are variables in PHP? Variables are developer defined words which holds certain information. (Who are developers? The one who is coding. What are information? Integer value, […]

PHP Print a text – Echo Function

PHP is a server side scripting language and it helps to establish communication between client system and server. The best way to learn php is to begin understanding of basics of PHP. In this PHP Basics chapter series, lets begin with printing a message – ‘Hello world’. PHP Echo Function: Lets begin our process with […]


For Web development, PHP is one of the important language, with out which we cant run a dynamic website. There were times when static websites were majorly used. As time passed, and demand raised, dynamic website occupied the entire internet space. With out a dynamic website, it is hard to provide user an engaging content. […]