Is it possible to create a global namespace alias in PHP or does the alias 
have to be defined in EVERY file that I use?  Here is an example:

file:  main.php
use \this\is\my\custom\namespace\Item as nsItem;

file:  index.php
require_once “main.php”;

// Attempt to use namespace alias defined in main.php file

The above code doesn’t work for me.  The namespace alias defined in the 
main.php file isn’t accessible in the index.php file.  Is there a way to make 
the “nsItem” alias a “global” one, so that I don’t have to define it in EVERY 
file that I want to use?


Reply via email to