Variable scope (PHP)
Naar navigatie springen
Naar zoeken springen
Met het global
-keyword, kun je toegang krijgen tot de 'global' waarde van variabelen. Voorbeeld:
<?php $a = 1; $b = 2; function Sum() { global $a, $b; # Makes $a & $b here available $b = $a + $b; } Sum(); echo $b; ?>