Friday, 15 September 2017

PHP Operators

Operators :-

Operators are used to perform operations on variables and values.

PHP divides the operators in the following groups:
  • Arithmetic operators
  • Assignment operators
  • Comparison operators
  • Increment/Decrement operators
  • Logical operators
  • String operators
  • Array operators
  • Bitwise operators

Let us understand all the operators with an example. Consider the following screenshot:-


This is the main page, containing the example links of all the operators in PHP. The code of the above page is as follows:-


Now, when I click on the "examples" of "Arithmetic operators", the output will be like this - 

The code for the above page is as follows:- 


When I click on the "examples" of "Assignment operators", the output will be like this - 


The code for the above page is as follows:- 



When I click on the "examples" of "Comparison operators", the output will be like this - 




The code for the above page is as follows:- 



When I click on the "examples" of "Increment/Decrement operators", the output will be like this - 



The code for the above page is as follows:- 


When I click on the "examples" of "Logical operators", the output will be like this - 


The code for the above page is as follows:-


When I click on the "examples" of "String operators", the output will be like this - 


The code for the above page is as follows:-



When I click on the "examples" of "Array operators", the output will be like this - 
The code for the above page is as follows:-


When I click on the "examples" of "Bitwise operators", the output will be like this - 


The code for the above page is as follows:-


No comments:

Post a Comment