PHP Error Types

While coding, or developing a PHP website or even in production stage, a website encounters. These errors could be result of wrong coding, mistake in the code, wrong implementation of code or any similar reason. PHP has list of errors that occur in a web project. PHP Error Types Parse Error Parse Error also known […]

PHP Constants

Constants are used in a PHP project whose value never changes. Such values can be defined as constant variables. The only important point we need to remember, PHP Constant variable values can not be overwritten.Such variables are defined once and remains same as long as website exists. PHP Constant PHP constant can be defined using […]

PHP Super Global Variables

PHP has provided predefined variables which are called super globarl variables. In a PHP website project, there might be situation to store logged in user information, access web url info and server related data. In such cases, super global variables are useful. PHP Super Global Variables There are nine types of Super Global Variables exist […]

PHP Switch Case

If we have more than one tasks to executed depending upon conditions, then in such case we use switch statement in php. Switch To better understand the usage of Switch, lets consider following example. Example print value of the variable. <?php $num=4; if($num==0){ echo “The value of num is 0”; }elseif($num==1){ echo “The value of […]

PHP While Loop

While loop is another best solution to handle tasks that are done in repetition. To better understand while loop you must have good understanding of for loop. Read: PHP For Loop While Loop In the previous chapter, I have mentioned, before using for loop, we must have to answer following three questions. What is the starting […]

PHP For Loop

In some cases we may need to complete a task in loop. To handle such situation, we have for loop in PHP. For Loop Lets begin with an example to understand the need of “for loop” Example Lets print 1 to 10 Solution: <?php $num=1; echo $num.'<br/>’; $num++ // incremented the value by 1 echo $num.'<br/>’; $num++ […]

PHP Assignment Operators

To better understand what is an assignment operator, lets re-think once again how do we declare a variable and set value to it? Read Article: Variable Declaration in PHP Assignment Operator The symbol of assignment operator is = Example <?php $num=100; ?> In the above example, we have declared variable name $num. It holds the value […]

PHP Arithmetic Operators

To perform arithmetic operations PHP has operators that performs the task. Operators Addition Operator As the name says, arithmetic operator performs arithmetic operation. The symbol of addition operator is + Example <?php $num1=10; $num2=20; echo $num1+$num2; ?> Output:30 Subtraction Operator Subtraction Operator performs subtraction operation. The symbol of subtraction operator is – Example <?php $num1=20; $num2=10; echo $num1-$num2; ?> Output: 10 […]

PHP If Else IF Else Statement

Before proceeding further lets first understand why if else if statement requirement came? Lets consider the simple situation, login process. A user is only allowed to access web pages of a website, if the user has logged in with valid credentials. See in the above case, “if” logic is there. Logic for login is as […]

PHP Different Data Types

PHP variables can store different data types. Unlike Java, .Net, C#, In PHP we do not require a keyword to define the data type. PHP engine is designed in a way that it can understand the type of data from the assigned value. So what are the data types which PHP engine understands? PHP Data […]

PHP Variable Declaration

Variables are essential in any coding world. It helps to code more efficiently. Lets see how can we define variables in PHP. PHP Variable Declaration In PHP, any variable name should always begin with a dollar sign ($) followed with a name. The name should not contain space. Example: <?php $fruit_name=”Apple”; $employeeAge=22; $Bike-Mileage=20.02 ?> Note: […]

PHP Single Line Comment and Multi-line Comments

Comments are essential in any coding world. PHP is also providing commenting option. Comments are helpful to include in our script pages, where we can write the purpose of a code.  In PHP we can define single line comments and multiple line comments. Single Line Comments As the name says, these are one line statement. […]

Introduction To PHP

PHP is a server side scripting language. It was created by Rasmus Lerdorf in 1994. It is one of the popular scripting language widely used to access data from server. PHP Current Version The current version of PHP is 7.4.3 Why Should we learn PHP? PHP is free. Easy to learn. And most importantly, most […]