I want to check two variables a and b and assign both the variable to new variable "c" and want to get the OR result from both the variables. for example if a=1 and b=0, c must be 1, while if a=0 and b=1, c must be 1, if a=0 and b=0 then c=0, for this purpose i am using the following | operator, which returns the required result, but i am not sure if i am doing it correct or not
<?php
$a = 0;
$b = 1;
$c = $a | $b;
echo("Value in $c = ".$c);
?>
EDIT: i have gone through the PHP.NET website and find that:
$a | $b Or (inclusive or) Bits that are set in either $a or $b are set.
Reference: http://php.net/manual/en/language.operators.bitwise.php
|is bitwise or. you might be looking for||(which is a logical or)|,&, ...) and logical (&&,||,...) operators.?>|and you are doing it right.