* updated index.md Added new paragraph for assigment operator. Edited "More Inofrmation" section by adding two links. * Fixed formatting issues and assignment statement
		
			
				
	
	
		
			85 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
			
		
		
	
	
			85 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
---
 | 
						|
title: PHP Operators
 | 
						|
---
 | 
						|
## PHP Operators
 | 
						|
 | 
						|
<p>Operators are used to perform operations on variables and values.</p>
 | 
						|
<p>PHP divides the operators in the following groups:</p>
 | 
						|
<ul>
 | 
						|
  <li>Arithmetic operators</li>
 | 
						|
  <li>Assignment operators</li>
 | 
						|
  <li>Comparison operators</li>
 | 
						|
  <li>Increment/Decrement operators</li>
 | 
						|
  <li>Logical operators</li>
 | 
						|
  <li>String operators</li>
 | 
						|
  <li>Array operators</li>
 | 
						|
</ul>
 | 
						|
<h3>PHP Arithmetic Operators</h3>
 | 
						|
<p>The PHP arithmetic operators are used with numeric values to perform common arithmetical operations, such as addition, subtraction, multiplication etc.</p>
 | 
						|
<table>
 | 
						|
  <tr>
 | 
						|
    <th>Operator</th>
 | 
						|
    <th>Name</th>
 | 
						|
    <th>Example</th>
 | 
						|
    <th>Result</th>
 | 
						|
  </tr>
 | 
						|
  <tr>
 | 
						|
    <td>+</td>
 | 
						|
    <td>Addition</td>
 | 
						|
    <td>$a + $b</td>
 | 
						|
    <td>Sum of $a and $b</td>
 | 
						|
  </tr>
 | 
						|
  <tr>
 | 
						|
    <td>-</td>
 | 
						|
    <td>Subtraction</td>
 | 
						|
    <td>$a - $b</td>
 | 
						|
    <td>Difference of $a and $b</td>
 | 
						|
  </tr>
 | 
						|
  <tr>
 | 
						|
    <td>*</td>
 | 
						|
    <td>Multiplication</td>
 | 
						|
    <td>$a * $b</td>
 | 
						|
    <td>Product of $a and $b</td>
 | 
						|
  </tr>
 | 
						|
  
 | 
						|
  <tr>
 | 
						|
    <td>/</td>
 | 
						|
    <td>Division</td>
 | 
						|
    <td>$a / $b</td>
 | 
						|
    <td>Quotient of $a and $b</td>
 | 
						|
  </tr>
 | 
						|
  <tr>
 | 
						|
    <td>%</td>
 | 
						|
    <td>Modulus</td>
 | 
						|
    <td>$a % $b</td>
 | 
						|
    <td>Remainder of $a divided by $b</td>
 | 
						|
  </tr>
 | 
						|
  <tr>
 | 
						|
    <td>**</td>
 | 
						|
    <td>Exponentiation</td>
 | 
						|
    <td>$a ** $b</td>
 | 
						|
    <td>Result of raising $a to the $b'th power </td>
 | 
						|
  </tr>
 | 
						|
</table>
 | 
						|
 | 
						|
### PHP Assignment Operators
 | 
						|
 | 
						|
The assignment operator is `=`. The operand on the left side gets assigned the value of the expression on the right.
 | 
						|
 | 
						|
#### Example
 | 
						|
 | 
						|
```php
 | 
						|
<?php
 | 
						|
 | 
						|
  $a = 7; // $a set to 7.
 | 
						|
  
 | 
						|
 ?>  
 | 
						|
```
 | 
						|
 | 
						|
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds  -->
 | 
						|
 | 
						|
#### More Information:
 | 
						|
- <a href='http://php.net/manual/en/language.operators.arithmetic.php' target='_blank' rel='nofollow'>Arithmetic Operators</a></li>
 | 
						|
- <a href='http://php.net/manual/en/language.operators.assignment.php' target='_blank' rel='nofollow'>Assignment Operators</a></li>
 | 
						|
 |