title: PHP eval error when assigning value to variable
body: <p>I have a bit of PHP code (for the module feature of my CMS (not drupal) which allows people to view pages, comments, forum posts, blog posts, etc...):</p>
  
  <pre><code>if(isset($_GET["m"]))
  {
      //Does the module exist and activated, and has it a function called view?
      if(isset($module_exists[$_GET["m"]]) &amp;&amp; method_exists($_GET["m"], "view"))//Yep
      {
          //Load view (should be an array)
          eval("$module_view = ".$_GET["m"]."::view();");
          if(!is_array($module_view))//Not an array :(
          {
              error::e500module($_GET["m"], $_SERVER["REQUEST_URI"]);
          }
      }
      else//Nope, so display error
      {
          error::e404($_SERVER['REQUEST_URI']);
      }
  }
  </code></pre>
  
  <p>Now, I get this errors when parsing the page:</p>
  
  <pre><code>Notice: Undefined variable: module_view in C:\wamp\www\SYSTEM\start.php on line 34
  
  Parse error: parse error in C:\wamp\www\SYSTEM\start.php(34) : eval()'d code on line 1
  
  Notice: Undefined variable: module_view in C:\wamp\www\SYSTEM\start.php on line 35
  </code></pre>
  
  <p>But when I do:</p>
  
  <pre><code>eval("print_r(".$_GET["m"]."::view());");
  </code></pre>
  
  <p>instead of:</p>
  
  <pre><code>eval("$module_view = ".$_GET["m"]."::view();");
  </code></pre>
  
  <p>I don't get any error, but simply the array printed. Does anyone know what I do wrong? I don't understand it. Please don't tell me that eval() is not safe, I know.</p>
  
  <p>Thanks.</p>