What will the $array array contain at the end of this script?
function modifyArray (&$array)
{
foreach ($array as &$value)
{
$value = $value + 1;
}
$value = $value + 2;
}
$array = array (1, 2, 3);
modifyArray($array);
Answer : B
What is the output of the following code?
var_dump(boolval(new StdClass()));
Answer : A
What is the output of the following code?
var_dump(boolval([]));
Answer : B
Consider the following code:
$result = $value1 ??? $value2;
Which operator needs to be used instead of ??? so that $result equals $value1 if $value1 evaluates to true, and equals $value2 otherwise? Just state the operator as it would be required in the code.
See Below Explanation:
Answer : A
How should class MyObject be defined for the following code to work properly? Assume $array is an array and MyObject is a user-defined class.
$obj = new MyObject();
array_walk($array, $obj);
Answer : D
What will be the result of the following operation?
$a = array_merge([1,2,3] + [4=>1,5,6]);
echo $a[2];
Answer : B
What will be the result of the following operation?
array_combine(array("A","B","C"), array(1,2,3));
Answer : C