7. Which values should be assigned to the variables $a, $b and $c in order for the following script to display the string Hello, World!?
<?php
$string = "Hello, World!";
$a = ?;
$b = ?;
$c = ?;
if($a) {
if($b && !$c) {
echo "Goodbye Cruel World!";
} else if(!$b && !$c) {
echo "Nothing here";
}
} else {
if(!$b){
if(!$a && (!$b && $c)) {
echo "Hello, World!";
} else {
echo "Goodbye World!";
}
} else {
echo "Not quite.";
}
}
?>
Вариант ответа 1 - A) False, True, False
Вариант ответа 2 - B) True, True, False
Вариант ответа 3 - C) False, True, True
Вариант ответа 4 - D) False, False, True
Вариант ответа 5 - E) True, True, True
Комментарий: Following the logic of the conditions, the only way to get to the Hello, World! string is in the else condition of the first if statement. Thus, $a must be False. Likewise, $b must be False. The final conditional relies on both previous conditions ($a and $b) being False, but insists that $c be True (Answer D).