image


Valora:  2.5/5
Inicio » PHP » PHP Tutorial » Operators




Logical Operators

Logical operators are used to evaluate several comparisons, by combining their possible values.

Operator Name Example Returns true when:
&& Y (7>2) && (2<4) Returns true when both conditions are true.
and Y (7>2) and (2<4) Returns true when both conditions are true.
|| O (7>2) || (2<4) Returns true when at least one of the two conditions is true.
or O (7>2) or (2<4) Returns true when at least one of the two conditions is true.
! No ! (7>2) Denies the value of the expression.


<!-- PHP Tutorial WebEstilo.com -->
<html>
<head>
   <title>PHP Example</title>
</head>
<body>
<?php
   $a = 8;
   $b = 3;
   $c = 3;
   echo ($a == $b) && ($c > $b),"<br>";
   echo ($a == $b) || ($b == $c),"<br>";
   echo !($b <= $c),"<br>";
?>

</body>
</html>

Execute View code






WebEstilo.com - Introduzca su e-mail y conozca las novedades. No hacemos Spam.
Google
  Web WebEstilo.com   
 
Valid HTML 4.01!
Última modificación:24 de Diciembre de 2004. Spain - España.
© 1998-2004 por Joaquin Gracia. Todos los derechos reservados.