I want to have a variable that may be used inside and outside of the functions. On PHP manual I found the following example: http://php.net/manual/ro/language.variables.scope.php
<?php
$a = 1;
$b = 2;
function Sum()
{
global $a, $b;
$b = $a + $b;
}
Sum();
echo $b;
?>
Manual says:
The above script will output 3.
But my laravel output for this code (in public show function inside a contreller) is 2.
How to make this work as needed?