What will be the output of the following PHP code (1)?

18. What will be the output of the following PHP code?

<?php
$x = 5;

function myFunction(){
    echo "Result $x";
}
myFunction();
?>
  1. Result $x
  2. Result 5
  3. Result
  4. None of the above

Answer: C) Result

Explanation:

The variable x is a global variable, and can only be accessed outside a function.

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.