VisualBuilder
  Home > Php > Tutorials > Logical Operators - PHP Tutorial
Tell a friend
Link to us
Total Members
      Members: 84661
     
Sitemap Forum Chat
Home
PHP Tutorial Home
1 . An Introduction to PHP
2 . Getting Started With Variables
3 . Comments in PHP
4 . Operators
5 . The Switch Statement
6 . Logical Operators
7 . Boolean Values
8 . Working with HTML Forms
9 . Programming Loops
10 . Arrays in PHP
11 . String Manipulation
12 . Create your own Functions
13 . Date and Time Functions in PHP
14 . Working With Files In PHP
 
 
PHP Home
PHP Members (3076)
PHP Member Articles ( 9 )
PHP Discussion (11)
PHP Q & A ( 13 )
- PHP Ask Question
- PHP Questions
- PHP Unanswered Questions
PHP Resources
PHP Source Code (463)
PHP Articles (118)
PHP Blogs (30)
PHP Jobs (0)
PHP Components (24)
PHP Books (3)
PHP Websites (29)
PHP News (17)
 
GROUPS
.NET
ASP.NET
.NET
C#
ASP
Visual Basic
Java
Java
JSP
EJB
Other
Delphi
C++
Ajax
UML
JavaScript
PHP
Web Design
Web Hosting
SQL Server
Oracle
Project Management
More Groups

 
LEARNING CENTER
TUTORIALS
.NET
.NET Tutorial
ASP Tutorial
ASP.NET Database Tutorial
ASP.Net Security,Internationalisation And Deployment
ASP.NET Tutorial
C# Tutorial
Web Development
Flex Tutorial
HTML Tutorial
Learn AJAX Tutorial
PHP Tutorial
Software Development
Database Tutorial
SQL Tutorial
UML Tutorial
Java
Ant Tutorial
EJB 3 Tutorial
Hibernate Tutorial
Java Tutorial
Java Web Component Tutorial
Java XML Tutorial
JDBC Tutorial
JDK1.5 Tutorial
JSF Tutorial
JSP And J2EE Design Tutorial
JSP Tutorial
Spring Tutorial
Struts Tutorial

RESOURCES
Q & A (451 )
Source Code (3275 )
Articles (359 )
Books (372 )
Components (1596 )
News (892 )
Websites (1207 )

SUBMISSIONS
Submit Article
Submit Website
Submit News
Submit Source Code
Submit Component

COMMUNITY
Members Directory
Discussion Forum
Chat

SITE
About Us
Sitemap
Search
Contact Us
Link To Us
Feedback
Tell a Friend
Partners
Advertise

Php Tutorial
 Logical Operators
  << Prev: The Switch Statement Next: Boolean Values >>

Logical Operators


AND   Are both values true? e.g $variable AND $variable2


 


if ($username =='user' AND $password =='password')


{
   echo "Welcome user";
}
else


{
   echo "Invalid Login Detected";
}


 


XOR   Is at least one value true,but NOT both? e.g $variable XOR $variable2


 


if ($username =='user' XOR $username =='user2')


{
   echo "Welcome ".$username;
}
else


{
   echo "Invalid Login Detected";
}


 


OR   Is at least one value true? e.g $variable OR $variable2


 


if ($username =='user' OR $username =='user2')


{
   echo "Welcome ".$username;
}
else


{
   echo "Invalid Login Detected";
}


 


!   Is NOT something e.g $variable

&&   Are both values true? e.g $variable && $variable2


 


if ($username =='user' && $password =='password')


{
   echo "Welcome user";
}
else


{
   echo "Invalid Login Detected";
}


 


||   Is at least one value true? e.g $variable || $variable2


 


if ($username =='user' || $username =='user2')


{
   echo "Welcome ".$username;
}
else


{
   echo "Invalid Login Detected";
}



  << Prev: The Switch Statement Next: Boolean Values >>
Php Tutorial Home
Give feedback and win a prize.

 
   Printer Friendly
   Email to a friend
   Add to my Favourites    
  Download PDF version
   Report Bad Submissions
   Submit Feedback
 
  Delicious   Digg   Technorati   Blink   Furl   Reddit   Newsvine   Google Click each image to add
this page to each site.
 
 
Welcome Guest Signup
MEMBER'S PANEL
EMAIL
PASSWORD
Forgot your password?
New User? Click Here!
 
Resend Activation Email!
 
SEARCH
 
 
 
ADVERTISEMENT
Partner List
Code Project
ASP Alliance
More
 
 
 
 

Home | Login | About Us | Contact Us | Privacy Policy | Advertising