Hey..
I wonder what's the difference between the use of || and OR
I have an example:

$Assumed_Variable = 1;
$Assumed_Query = mysql_query("select something from someTable",$connection);
if($Assumed_Variable == 1 || mysql_num_rows($Assumed_Query) > 0){
  echo 'Success!';
}
else{
  echo 'Failure!';
}

So, if I understand this issue, this means that the code above will apparently print "Success!", but the parser will first look at the second part of the condition because the precedence is its.
However, have I put OR instead of ||, then the parser will check the first part of the condition, and, since it's true, it'll not look at the second part. And this way is faster because it won't take time using the function Mysql_num_rows().
Am I right in all of this?
Thank you.

The IF statement will still compare everything. The only difference between "||" and "OR" is that "AND" is calculated before "OR" but after "||".

commented: Thank you. +3

usually || is used as an operator for the comparison of two or more BOOLEAN statements. The OR is used for comparison of two or more ERROR HANDLING statements.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.