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 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

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 $ 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 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 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 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 Comments

PHP comments are not considered part of the code, since the commented code is not visible to the browser. Basically, it helps the developer to write notes about their code which will later on help them to understand the code. These PHP comments are visible to anyone who visit the source code. Uses of PHP Comments: Helps … 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 String Functions

String can store letters, numbers, and even special characters. It is basically non-numeric data type. As we have discussed the String data type in PHP String. In this chapter, we’ll look at some of the more commonly used PHP String functions. PHP String Functions Now lets discuss some built-in PHP string functions. Built-in functions PHP string functions are some existing library functions … Read more

Categories PHP