Laravel blade global variable
<p>I have a problem in global variables in laravel. I know about view composer and my question is not related to that subject.
How can I do such a simple thing in laravel view (*.blade.php | <em>.php) template engine?
for example this is a sample code from one of my views (</em>.blade.php | *.php):</p>

<pre><code>&lt;?php
   function myFunc() {
     global $myvar;
     if ( ! $myvar ) {
       $myvar = 'my var is empty';
     }
     dd( $myvar );
   }

  $myvar = 'my var value';
  myFunc();
</code></pre>

<p>At the end of the execution it shows up 'my var is empty' and not 'my var value'.
Anybody knows why this happens?</p>