PHP redefine constant without runkit or another way to declare a namespace
<p>I am doing a framework similar to CodeIgniter but with namespaces. I don't want use runkit because many hosting providers don't have the extension.</p>

<p>The Namespaces are based on paths to the file class, if I who load the file class too I know the namespace has the class but I don´t know what sintax to use to declare the namespace.</p>

<p>I apologize for my english. I will try to explain me using a example:</p>

<pre><code>namespace \FlexIgniter\Core

class Load {
  public function loadClass($name, $ns) {
     runkit_constant_redefine("NAMESPACE_AUTO", $ns);
     $path = $this-&gt;class2path($class);
     include_once($path);
  }
}
</code></pre>

<p>The file to load:</p>

<pre><code>namespace NAMESPACE_AUTO;

class ToLoad {
  // do some stuff...
}
</code></pre>

<p>Thanks.</p>

<p>PS: <a href="https://github.com/Localnet/FlexIgniter" rel="nofollow">https://github.com/Localnet/FlexIgniter</a></p>
