PHP Data Types

PHP Data Types have been used to store various types of data or values. PHP supports eight primitive data types, which are further divided into three categories: Scalar Types (Predefined) Compound Types (user-defined) Special Types PHP Data Types: Scalar Types The Scalar types are also known as predefined data types. A scalar data type is the … Read more

Categories PHP

PHP String

Basically PHP string is a non-numeric data type. It is sequence of characters and it can store letters, numbers, and even special characters. Creating PHP String There are four ways of creating php string: Single-quote strings Double-quote strings  Heredoc Newdoc Most common ways of creating strings are using single/ double quotation, So will discuss them in detail. Single-quote strings: In PHP … Read more

Categories PHP

PHP $ and $$ Variables

The $var (single dollar) is a regular variable with the name var that can hold any value such as a string, integer, float, or other object. The $$var (double dollar) is a reference variable that contains the $variable’s value. Lets see an example to understand it clearly: Now Lets see an other example to understand … Read more

Categories PHP

PHP Operators

Operators in PHP are symbols that are used to execute operations on operands. In simple words, php operators are used to perform different operations on variables and their values. For example: In 4+5, + is an operator and 4 and 5 are values. Types of PHP Operators: In php operators are divided into following types: … Read more

Categories PHP

PHP Math

PHP Math functions allow you to perform mathematical operations on numbers. PHP Math Functions: There are several built-in functions in PHP that can help you with anything from basic addition and subtraction to complex calculations. PHP abs() Function: The abs() function is a PHP built-in function that returns the absolute (positive) value of a number. … Read more

Categories PHP

PHP Array Sorting

An array elements can be sorted alphabetically or numerically, and in either ascending or decreasing order. PHP Array Sorting Functions There are some php functions through which we can sort the arrays. Following are the functions used for php array sorting: Function Description sort() It sorts the array in ascending order rsort() It sorts the array … Read more

Categories PHP

PHP Numbers

In this chapter we will discuss PHP numbers in detail and also about functions related PHP numbers. PHP Numbers: Integer Integers can only store whole numbers with either positive or negative signs, such as, numbers without a fractional part or a decimal point. Rules for Integer Integer can be a positive or negative whole number. … Read more

Categories PHP

PHP Switch Statement

The switch statement in PHP is used to execute a single statement based on a set of multiple conditions. It’s similar to a PHP if-else-if statement. Syntax: PHP Switch Statement Working: We begin with a single expression n (usually a variable) that is evaluated only once. The value of the expression is then compared to … Read more

Categories PHP

PHP Loops

PHP Loops are used for repeating the same block of code till a specific condition reaches This saves the user time and effort by writing the code only once and by repeating it as many time as needed. Types of PHP Loops There are four types of loop in PHP: Loop Name Description For loop … Read more

Categories PHP

PHP Break and Continue

PHP Break As We have seen in switch case chapter that break statement is used to jump out of switch statement. The break statement is also used to jump out of loop statement. PHP Continue If a stated condition happens, the continue statement breaks one iteration (in the loop) and continues with the following iteration … Read more

Categories PHP