}
}
$s = array(0 => "my",
1 => "call",
2 => $function ,
3 => ,
4 => "function",
5 => $a ,
6 => $b ,
7 => a ,
8 => b ,
9 => );
$a = true;
$b = false;
/* Group A */
$name = $s[?].$s[?].$s[?].$s[?].$s[?].$s[?];
/* Group B */
$name(${$s[?]}, ${$s[?]});
?>

Each ? in the above script represents an integer index against the $s array. In order to display the Hello, World! string when executed, what must the missing integer indexes be? - Answer: D) Group A: 0,4,9,9,9,9 Group B: 7,8"> PHP Test online - 14. Consider the following script:<br><br><?php<br>function myfunction($a, $b = true)<br>{<br>if($a && !$b) {<br>echo "Hello, World! ";<br>}<br>}<br>$s = array(0 => "my",<br>1 => "call",<br>2 => $function ,<br>3 => ,<br>4 => "function",<br>5 => $a ,<br>6 => $b ,<br>7 => a ,<br>8 => b ,<br>9 => );<br>$a = true;<br>$b = false;<br>/* Group A */<br>$name = $s[?].$s[?].$s[?].$s[?].$s[?].$s[?];<br>/* Group B */<br>$name(${$s[?]}, ${$s[?]});<br>?><br><br>Each ? in the above script represents an integer index against the $s array. In order to display the Hello, World! string when executed, what must the missing integer indexes be? - True answer: D) Group A: 0,4,9,9,9,9 Group B: 7,8

PHP Test online


14. Consider the following script:

<?php
function myfunction($a, $b = true)
{
if($a && !$b) {
echo "Hello, World! ";
}
}
$s = array(0 => "my",
1 => "call",
2 => $function ,
3 => ,
4 => "function",
5 => $a ,
6 => $b ,
7 => a ,
8 => b ,
9 => );
$a = true;
$b = false;
/* Group A */
$name = $s[?].$s[?].$s[?].$s[?].$s[?].$s[?];
/* Group B */
$name(${$s[?]}, ${$s[?]});
?>

Each ? in the above script represents an integer index against the $s array. In order to display the Hello, World! string when executed, what must the missing integer indexes be?


Вариант ответа 1 - A) Group A: 4,3,0,4,9,9 Group B: 7,8

Вариант ответа 2 - B) Group A: 1,3,0,4,9,9 Group B: 7,6

Вариант ответа 3 - C) Group A: 1,3,2,3,0,4 Group B: 5,8

Вариант ответа 4 - D) Group A: 0,4,9,9,9,9 Group B: 7,8

Вариант ответа 5 - E) Group A: 4,3,0,4,9,9 Group B: 7,8


Comments: Functions can be called dynamically by appending parentheses (as well as any parameter needed) to a variable containing the name of the function to call. Thus, for Group A the appropriate index combination is 0, 4, 9, 9, 9, 9, which evaluates to the string myfunction. The parameters, on the other hand, are evaluated as variables dynamically using the ${} construct. This means the appropriate indexes for group B are 7 and 8, which evaluate to ${ a } and ${ b }—meaning the variables $a and $b respectively.

Comments

User nameComment
User name
Comment text
Code