title: using php namespaces correctly
body: <p>I have just started rebuilding my app i made to use namespaces to make future development easier and so we can reuse class names.</p>
  
  <p>basically my code is as follows.</p>
  
  <pre><code>&lt;?php
  session_start();
  
  error_reporting(E_ALL);
  ini_set('display_errors', 1);
  
  use core\marketing as marketing;
  use core\security as security;
  use core\structure as structure;
  use core\data as data;
  
  include 'marketing\cleanurl.php';
  ?&gt;
  </code></pre>
  
  <p>As soon as I run this I get the following error:</p>
  
  <blockquote>
    <p>Warning: include(marketing\cleanurl.php): failed to open stream: No such file or directory in /var/www/index.php on line 27 Warning: include(): Failed opening 'marketing\cleanurl.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/index.php on line 27</p>
  </blockquote>
  
  <p>My directory structure matches the namespaces as that is what I read on the net.</p>
  
  <p>Now if I change the include to match the directory i.e.</p>
  
  <pre><code>include 'core/marketing/cleanurl.php';
  </code></pre>
  
  <p>I get the following error</p>
  
  <blockquote>
    <p>Parse error: syntax error, unexpected T_CLASS, expecting T_NS_SEPARATOR or ';' or '{' in /var/www/twiggled/core/marketing/cleanurl.php on line 4</p>
  </blockquote>
  
  <p>This all worked when I was just using require_once to call all the classes but found this limited expansion of the system and made changes more time consuming and wanted to use namespaces as they have always been great in other languages I have used.</p>