Changes

Jump to: navigation, search

PHP Operators

892 bytes added, 12:58, 31 May 2007
PHP Increment and Decrement Operators
$var2 = $var1 / 2; // Sets variable $var2 to the value of 10 divided by 2
</pre>
 
== PHP Comparison Operators ==
 
The comparison operators provide the ability to compare one value against another and return either a ''true'' or ''false'' result depending on teh status of the match. For example you might use a comparison operator to check if a variable value matches a particular number, or whether one string is identical to another. PHP provides a wide selection of comparison operators for just about every comparison need.
 
The comparison operators are used with two operands, one to the left and one to the right of the operator. The following table outlines the PHP comparison operators and provides brief descriptions and examples:
 
<table>
<tr style="background:#efefef;">
<th>Operator</th>Description<th>Examples</th>
<tr>
<td>==<td>Equal to<td>Checks if first operand equals second<td>$myVar = 10; <br>if ($myVar == 10)<br>echo 'myVar equals 10';</td>
</table>
== PHP Increment and Decrement Operators ==

Navigation menu