PHP Operators

PHP Operators perform operations by taking one or more values, to give another value. These operations are performed on variables and values.

For example:  $a + $b,  $a – $b, $a = $b

The types of operators are explained here with an example, where $a = 5, $b =10. The following are the operators in PHP:

  • Arithmetic Operators
  • Assignment Operators
  • Relational Operators
  • Logical Operators
  • Increment/ Decrement Operators
  • String Operators

PHP Arithmetic operators

Arithmetic operators perform arithmetical operations, such as addition, subtraction, division, multiplication, etc.

PHP Assignment operators

Use the Assignment Operator when you need to assign a value to a variable. Assignment means assigning the value of the right operand(s) to the left operand.

PHP Relational operators

Compare two values with PHP relational operators.

PHP Logical operators

Logical operators combine conditional statements.

PHP Increment/ Decrement operators

Increment and decrement a variable’s value with Increment and Decrement operators respectively.

PHP String operators

Here are the operators for strings. Let’s say, we have the following two strings,

The following are the string operators:

PHP Constants
PHP Loops
Studyopedia Editorial Staff
contact@studyopedia.com

We work to create programming tutorials for all.

No Comments

Post A Comment

Discover more from Studyopedia

Subscribe now to keep reading and get access to the full archive.

Continue reading