This site is mobile accessible. Press the "Tap Here" button to use a different font-size.


Smartphone icons created by Freepik - Flaticon

Variable with global scope:

Variable x inside function is:

Variable x outside function is: 5

<?php
$x = 5; // global scope
 
function myTest() {
  // using x inside this function will generate an error
  echo "<p>Variable x inside function is: $x</p>";
} 
myTest();

// this works
echo "<p>Variable x outside function is: $x</p>";
?>