Variable x inside function is:

Variable x outside function is: 5



---------------------------------------------------------
Voici du code php intervenant dans ce visuel :

* La variable globale ne rentre naturellement pas dans la fonction :Source : https://www.w3schools.com/php/php_variables_scope.asp

$x = 5; // global scope

function myTest() {
// using x inside this function will generate an error
echo "Variable x inside function is: $x";
}
myTest();

echo "Variable x outside function is: $x";