Is it possible to create a global namespace alias?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



ï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
<?php
use \this\is\my\custom\namespace\Item as nsItem;
?>


file:  index.php
<?php
require_once âmain.phpâ;

// Attempt to use namespace alias defined in main.php file
nsItem::test();
?>


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?

-Matt

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux