Comparison of Variables in PHP
In the examples above, we compared a variable with some number. But nothing prevents us from comparing two variables.
See the example:
<?php
$test1 = 1;
$test2 = 2;
if ($test2 > $test1) {
echo '+++'; // this will work, because $test2 is greater than $test1
} else {
echo '---';
}
?>
Given the variables $test1 and $test2.
Check which value of these variables
is greater and display the corresponding message
on the screen.