Relational operators compare values and return either TRUE or FALSE. Logical operators perform logical operations on TRUE and FALSE. Values used with a logical operator are onverted into booleans prior to being evaluated. For numerical values, zero will be interpreted as FALSE, and other values will be TRUE. Empty strings are considered be FALSE, and any nonempty string is TRUE. lists the logical and relational operators.
Notice that the equality operator is very similar to the assignment operator. That's reasonable. One performs the action of making both sides equal; the right-side value is copied to the variable on the left side. The other asks the question, "Are both sides equal?" The inherent danger is that the two can be confused, and it is difficult to discover. PHP will allow you to put an assignment inside the parentheses of an if statement. If you have an if statement that always seems to evaluate one way, check to make sure you haven't typed = when you meant ==.
If you are unfamiliar with logical operations, refer to. The first two columns enumerate all the possible combined values of p and q, which stand for relational expressions. The other four columns show the results of performing a logical operation on p and q.
You might have noticed in two versions of the logical operators. For instance, there is both and AND. Operationally, they are the same, but they differ in precedence—a topic discussed at the end of this chapter. Aside from precedence, you are free to use them interchangeably.
PHP Related Interview Questions
|PHP Interview Questions||MySQL Interview Questions|
|PHP+MySQL Interview Questions||Drupal Interview Questions|
|MYSQL DBA Interview Questions||PHP5 Interview Questions|
|WordPress Interview Questions||Joomla Interview Questions|
|CakePHP Interview Questions||CodeIgniter Interview Questions|
|PHP7 Interview Questions|
An Introduction To Php
Variables, Operators, And Expressions
Classes And Objects
I/o And Disk Access
Time, Date, And Configuration Functions
Parsing And String Evaluation
Sorting Searching And Random Numbers
Integration With Html
Efficiency And Debugging
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.