icon
Related questions
Question
-5-
A PHP function is defined as follows:
function planets ($arr) {
if ($arr [1]) {
print "Mercury";
}
else {
for ($i=0; $i <= $arr [2]; $i++)
(print $arr [3] [$i];
}
}
print count ($arr);
Recall that array $arr can be defined using a statement of the form:
$arr array (...);
Give an array $arr such that planets ($arr) prints
Mercury
O
For this case, what is the output of the instruction
print count ($arr);
Give an array $arr such that planets ($arr) prints
Venus
o For this case, what is the output of the instruction
print count ($arr);
O Give an array $arr such that planets ($arr) prints
Earth Jupiter Saturn.
Note: the for loop must do three iterations in case (iii).
-6-
o For this case, what is the output of the instruction
print count ($arr);
3. (a)
Transcribed Image Text:-5- A PHP function is defined as follows: function planets ($arr) { if ($arr [1]) { print "Mercury"; } else { for ($i=0; $i <= $arr [2]; $i++) (print $arr [3] [$i]; } } print count ($arr); Recall that array $arr can be defined using a statement of the form: $arr array (...); Give an array $arr such that planets ($arr) prints Mercury O For this case, what is the output of the instruction print count ($arr); Give an array $arr such that planets ($arr) prints Venus o For this case, what is the output of the instruction print count ($arr); O Give an array $arr such that planets ($arr) prints Earth Jupiter Saturn. Note: the for loop must do three iterations in case (iii). -6- o For this case, what is the output of the instruction print count ($arr); 3. (a)
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer