0

Using == vs Using !=

 /*Testing some basic scenarios in PHP*/

$a=7;
$b=5;
echo $a==$b;



$a=7;
$b=5;
echo $a!=$b;

Output is blank screen in case 1. Output is 1 in case 2 .Why am I getting these respective outputs?

XESS Y
  • 11
  • 1
  • You better read some stuff from [here](https://www.php.net/manual/en/language.operators.php) – Rahul May 16 '19 at 06:01
  • Try `echo true;` and `echo false;`. The output is 1 and (empty) respectively. You can cast it to int by doing `echo (int)($a == $b);` to get 0 as the output. – Qirel May 16 '19 at 06:02
  • So echo output is in string format,right?Where true is '1' and false is blank? – XESS Y May 16 '19 at 06:17

0 Answers0