PHP Logical Operators

by Hiroshi on June 21, 2008

in Operators, PHP Basics

Logical operators are true or false.

NOT
if(!1)
Value is not one

AND
4 && 4 True
4 && 5 False

OR
if(4 || 5)
The value is 4 or 5

XOR
if (4 XOR 5)
The value is 4 or 5 but not both

Related Posts

  • PHP Operators Explanation In all programming languages, operators are used to manipulate or perform operations on […]
  • Simple PHP Script – Lets Start PHP – Echo Hello PHP If you want to learn PHP you have come to the right place. I will not only teach you how […]
  • PHP While Loop The while keyword takes a condition in parentheses, and the code block that follows is […]
  • PHP Do While Loop A "do while" loop is a slightly modified version of the while loop. A do-while loop […]
  • PHP Increment Operator Some of the most frequently used code in PHP or any programming language is the code […]
  • PHP Decrement Operator Some of the most frequently used code in PHP or any programming language is the code […]
  • Data Types In PHP Data types are many e.g. Boolean, Integer, Double (or float), String and there might be […]
  • Define Variable In PHP A variable is a means of storing a value, such as text string "Hello World!" or the […]
  • PHP Arrays An array is a data structure that stores one or more values in a single value. In more […]
  • PHP ForEach Loop PHP provides an easy way to use every element of an array with the For each statement. […]

Previous post:

Next post: