Categories
PHP

What are Logical Operators in PHP and how to use them

Logical Operators are used in conditional statement to join two statements. Conditional statements is basically If statement. There are 6 logical operator and we have gone through them one by one with example in the table below. The table below displays each operator with their name, using an example and expected result that you would […]

Categories
PHP

What are Comparison Operators in PHP and how to use them

There are 5 comparison types in PHP. The main job of comparison operator is to compare two values. The value can be string or numbers. PHP Comparison Operators are used inside conditional statements mainly to evaluate whether the value or statement is TRUE or FALSE. The table below will explain how it is used and […]

Categories
PHP

What are Assignment Operators and the differences of different assignment operators and their usage

Assignment operator is used to assign values to variables like in the example below. In this example, the variable $y has the same value as variable $x, because the value of variable $x is assigned to variable $y. Assignment operators can also be used with arithmetic operators. As shown in the example below we have […]

Categories
PHP

PHP Increments & Decrements and their usage with examples

An Increments operator is used to increment/increase a variable’s value by 1. For instance, if a variable’s value was 10 at first, the new value would be 11 after an increments. A Decrements operator is used to decrease/deduct a variable’s value by 1. For instance, a variable’s value is 10. the new value after a […]

Categories
PHP

What are PHP Arithmetic Operators and how to use an arithmetic operator in php

Operators are used for all mathematical calculations using variables and values. There are 5 Arithmetic operators that work with numbers only to perform a calculation. Operators Name Example + Addition $x + $y – Subtraction $x – $y * Multiplication $x * $y / Division $x / $y % Modulus $y % $y

Categories
PHP

What is PHP Variable Variables and their usage explained with examples

Variable Variables is a technique used in PHP, it gets the value of first variable. Then the value of the first variable becomes the name of the second variable. In our example below, the value of the first variable $name which is john in this case, will be the name of the second variable’s name […]

Categories
PHP

PHP Global Keyword and its benefits explained with example

Global keyword or global variable, which refers to any variable that is defined outside of the function, class or file. Therefore it can be access from anywhere in your code. In the example below, we have access to the global variable $name from outside of the function. Global variable is declared exactly like any other […]

Categories
PHP

How to Combine or Concatenate two Variables in PHP

Combining or Concatenation of two variables is when two variables are used together. These variables can hold any value, integers or strings. Integers are easier to be combined with an addition (+), multiplication (*), division (/) or modulus (%). Not only these you can also use combination of these arithmetic signs. On the other hand […]

Categories
PHP

PHP Boolean data type, all you need to know

Boolean is the simplest data type in PHP. It can only hold two values. These values are true or false. These values are not case sensitive. Boolean is normally used to check a result. Whether a result is meant to be what it is expected from.  True is also seen as 1 and False is […]

Categories
PHP

PHP Integers data type, all you need to know

An Integer is a whole number (without fraction).  An integer can be positive (128) or negative (-128). The table below shows an integer in four different notations. Notation Decimal Hexadecimal Octal Binary Preceded with   0x 0 0b Example 128 0x80 0200 0b10000000 The example below shows a usage of integer assigned to a variable […]