2. Write a script that creates two variables and assigns a different integer value to each variable.
Now make your script test whether the first value is
a. equal to the second value
b. greater than the second value
c. less than or equal to the second value
d. not equal to the second value
and output the result of each test to the user.
Exercise 2 Solution
Write a PHP script such as this:
< ?php
$x = 3;
$y = 4;
echo "Test 1 result: " . ($x == $y) . " < br / > ";
echo "Test 2 result: " . ($x > $y) . " < br / > ";
echo "Test 3 result: " . ($x < = $y) . " < br / > ";
echo "Test 4 result: " . ($x != $y) . " < br / > ";
? >
Now whats missing to make it work?
Now make your script test whether the first value is
a. equal to the second value
b. greater than the second value
c. less than or equal to the second value
d. not equal to the second value
and output the result of each test to the user.
Exercise 2 Solution
Write a PHP script such as this:
< ?php
$x = 3;
$y = 4;
echo "Test 1 result: " . ($x == $y) . " < br / > ";
echo "Test 2 result: " . ($x > $y) . " < br / > ";
echo "Test 3 result: " . ($x < = $y) . " < br / > ";
echo "Test 4 result: " . ($x != $y) . " < br / > ";
? >
Now whats missing to make it work?