Zend
200-530 · Question #519
Consider the following PHP script: 1. <?php 2. $a = 5; 3. $b = 10; 4. function Mul() 5. { 6. ******************* 7. } 8. Mul(); 9. print($b); 10. ?> What can you write instead of *** on line 6 to…
The correct answer is A. $b = $a * $b; D. global $a, $b. See the full explanation below for the reasoning.
Question
Consider the following PHP script: 1. <?php 2. $a = 5; 3. $b = 10; 4. function Mul() 5. { 6. ********************** 7. } 8. Mul(); 9. print($b); 10. ?> What can you write instead of ****** on line 6 to get the output 50? Each correct answer represents a complete solution. Choose all that apply.
Options
- A$b = $a * $b;
- B$GLOBALS['b'] = $GLOBALS['a'] * $GLOBALS['b'];
- Cglobals($b = $a * $b);
- Dglobal $a, $b;
How the community answered
(25 responses)- A80% (20)
- B8% (2)
- C12% (3)
Community Discussion
No community discussion yet for this question.