-
What will be the output of the following PHP code ?
<?php
$p = 45;
$q = 26;
function add()
{
$GLOBALS['r'] = $GLOBALS['p'] + $GLOBALS['q'];
}
add();
echo $r;
?>
-
- Error
- 45
- 26
- 71
- None of these
Correct Option: D
r is a variable present within the $GLOBALS array, it is also accessible from outside the function!