Re: Is it possible to create a global namespace alias?

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

 



ïI'm assuming there is no way to make a global alias. Can anyone confirm/deny this?



""Matt Palermo"" wrote in message news:5E7B8989448B45DBBEEB6FB89B3F350E@xxxxxxxxx

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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[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