Home PHP Ajax Regex Interviews Contact us    

PHP


Interview Questions


Comparison Operators

Comparison operators, allow you to compare two values.Also Comparisons are used to check the relationship between variables and/or values. These are the comparison operators in php


OperatorNameResult
$a == $bEqualTRUE if $a is equal to $b.
$a === $bIdenticalTRUE if $a is equal to $b, and they are of the same type.
$a != $bNot equalTRUE if $a is not equal to $b.
$a <> $bNot equalTRUE if $a is not equal to $b.
$a !== $bNot identicalTRUEif $a is not equal to $b, or they are not of the same type.
$a < $bLess thanTRUE if $a is strictly less than $b.
$a > $bGreater thanTRUE if $a is strictly greater than $b.
$a <= $bLess than or equal to TRUE if $a is less than or equal to $b.
$a >= $bGreater than or equal to TRUE if $a is greater than or equal to $b.

Example

<?php
$my_name = "john";
if ( $my_name == "john" ) {
echo "Your name is john!";
}else{
echo "WYour name is not john!";
}
?>


Feed Back of this Topic
 
Name :
Email :
Topic :
Comments :

Ajax


Regular Expression


 
Copyright © 2007 123developers.com
Contact us | Disclaimer