Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compare two integers

How do you compare two integers in php?

I have tried

print (1 > 2);           // No output
$a = 1;
$b = 2;
$c = ($a > $b) ? true : false;
print ($c);              // No output

var_dump works fine. I have the latest PHP installed.

like image 543
MontrealDevOne Avatar asked Dec 12 '22 01:12

MontrealDevOne


1 Answers

Both of your comparisons return false which will not print out a value.

<?php
echo true;
echo false;
like image 63
Rawkode Avatar answered Dec 27 '22 03:12

Rawkode