= sign is used as the assignment operator in PHP. The assignment operator is used to assing a value to a variable.

Example:

$yourage=18;

Operator | Description | Example | Result |

+ | Addition | a=1+2 | 3 |

- | Subtraction | a=3-1 | 2 |

* | Multiplication | a=2*5 | 10 |

/ | Division | 10/2 | 5 |

% | Modulus (division remainder) | 10%2 | 0 |

++ | Increment | a=3 a++ | a=4 |

-- | Decrement | a=3 a-- | a=2 |

The comparison operators as shown below are used to compare two variables or expressions. The result of the comparison operation can be true or false.

Operator | Description | Example |

== | equal to | 1==2 evaluated to false |

!= | not equal | 1!=2 evaluated to true |

> | greater than | 1>2 evaluated to false |

< | less than | 1<2 evaluated to true |

>= | greater than or equal to | 1>=2 evaluated to false |

<= | less than or equal to | 1<=2 evaluated to true |

Operator | Description | Example |

&& | and | x=1 y=2 (x < 5 && y > 1) evaluated to true |

|| | or | x=1 y=2 (x>2 || y>1) evaluated to true |

! | not | x=1 y=2 !(x==y) evaluated to true |

Each compound operator combines two operators together. For example a compound operator might combines the adding operator and the assignment operator.

Operator | Example | The Same As |

+= | x+=y | x=x+y |

-= | x-=y | x=x-y |

*= | x*=y | x=x*y |

/= | x/=y | x=x/y |

.= | x.=y | x=x.y |

%= | x%=y | x=x%y |

In PHP, the point symbol (.) is used to concatenate strings.

Example:

$yourname="Yuk"."Sovandara";

HTML Comment Box is loading comments...

This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages:

C, C++, C#, Java, VB.NET, Python, VBA,PHP & Mysql, SQL, JSP, ASP.NET,HTML, CSS, JQuery, JavaScript and other applications such as MS Excel, MS Access, and MS Word. However, we don't guarantee all things of the web are accurate. If you find any error, please report it then we will take actions to correct it as soon as possible.