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

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

<?php
function myFunction()
{
    $x = 5;
    echo "Result1: $x , ";
}
myFunction();
echo "Result2: $x";
?>
  1. Result1: 5 , Result2:
  2. Result1: 5 , Result2: 0
  3. Result1: 5 , Result2: 5
  4. None of the above

Answer: A) Result1: 5 , Result2:

Explanation:

The variable x is a local scope, and can only be accessed within that function.

Comments and Discussions!

Load comments ↻






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