Write a PHP program to check if three given numbers are in strict increasing order, such as 4 7 15, or 45, 56, 67, but not 4 ,5, 8 or 6, 6, 8.However,if a fourth parameter is true, equality is allowed, such as 6, 6, 8 or 7, 7, 7
<?php function test($x, $y, $z, $flag) { return $flag ? $x <= $y && $y <= $z : $x < $y && $y < $z; } var_dump(test(1, 2, 3, false))."\n"; var_dump(test(1, 2, 3, true))."\n"; var_dump(test(10, 2, 30, false))."\n"; var_dump(test(10, 10, 30, true))."\n";
Sample Output:
bool(true) bool(true) bool(false) bool(true)
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Sample Output:
need an explanation for this answer? contact us directly to get an explanation for this answer