Category PHP

Operator Precedence in PHP

In this tutorial, we’ll learn about the operator precedence and associativity in PHP with important examples. In PHP, expressions are in general evaluated from left to right. However, when an expression contains more than one operator, operator precedence determines the…

Bitwise Operators in PHP

The bitwise operators are those operators in PHP which allow you to perform operations on the binary representations of integers. Each integer value is represented by a sequence of bits (0s and 1s). We commonly use bitwise operators to perform…

Ternary Operator in PHP

An example of PHP ternary operator or conditional operator.

The ternary operator in PHP provides a one-line approach to representing a simple conditional statement. We commonly use it as a shorthand method for if-else statement which makes the code much more simple, concise and readable. The ternary operator allows…

Logical Operators in PHP

Logical operators in PHP are those operators which are used to form compound conditions by combining two or more conditional statements. In other words, logical operators allow you to compare conditions or values. These operators are also called Boolean operators…

Increment and Decrement Operators in PHP

Learn increment and decrement operators in PHP.

Increment and decrement operators in PHP are those operators that are used to change the value of an operand (constant or variable) by 1. We generally use these operators in loops, counters, and similar operations. A unique characteristic of increment…