0% found this document useful (0 votes)
16 views

PHP - Operators: Echo Lesson

This document discusses operators in PHP programming language. It explains that operators are used to manipulate variables and values. There are different categories of operators in PHP including assignment, arithmetic, comparison, string, and combination arithmetic & assignment operators. Assignment operators set a variable equal to a value or another variable's value using the "=" sign. Arithmetic operators perform mathematical operations like addition, subtraction, multiplication, division, and modulus.

Uploaded by

Anil Kumar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

PHP - Operators: Echo Lesson

This document discusses operators in PHP programming language. It explains that operators are used to manipulate variables and values. There are different categories of operators in PHP including assignment, arithmetic, comparison, string, and combination arithmetic & assignment operators. Assignment operators set a variable equal to a value or another variable's value using the "=" sign. Arithmetic operators perform mathematical operations like addition, subtraction, multiplication, division, and modulus.

Uploaded by

Anil Kumar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

PHP - Operators

In all programming languages, operators are used to manipulate or perform operations on variables and
values. You have already seen the string concatenation operator "." in the Echo Lesson and the assignment
operator "=" in pretty much every PHP example so far.
There are many operators used in PHP, so we have separated them into the following categories to make
it easier to learn them all.

• Assignment Operators
• Arithmetic Operators
• Comparison Operators
• String Operators
• Combination Arithmetic & Assignment Operators

Assignment Operators

Assignment operators are used to set a variable equal to a value or set a variable to another variable's
value. Such an assignment of value is done with the "=", or equal character. Example:

• $my_var = 4;
• $another_var = $my_var

Now both $my_var and $another_var contain the value 4. Assignments can also be used in conjunction
with arithmetic operators.

Arithmetic Operators

Operator English Example


+ Addition 2+4
- Subtraction 6-2
* Multiplication 5 * 3
/ Division 15 / 3
% Modulus 43 % 10

You might also like