Hi!

------------------------------------------------------------------------
 1. include.php <?php

namespace Test;

class Bar { public static function baz() { return 'namespaced static
method'; } }

function foo() { return 'namespaced function'; }


------------------------------------------------------------------------
 2. index.php <?php

require_once 'include.php'; use Test::Bar;

class Test { public static function foo() { return 'static method'; }
 }

I would advise you to avoid calling your classes and namespaces by the same name, for the sake of clarity - especially if you are going to have identically named static functions in both. You can always have My::Test instead, etc.

2. How should I call the static method
baz of class Bar in namespace Test with call_user_func

call_user_func(array('Test::Bar', 'baz')). Remember, the true name is always the full name.

3. Is there no possibility to change your minds and replace the double colon 
with
something else, likes a simple colon?

With simple colon - not likely.

I find it very confusing to
figure out what is what and the way I should call it.

You should always use full name with call_*, reflection, variable class names and other runtime constructs. You can use shortcuts with static constructs - where you specify the class name explicitly.
--
Stanislav Malyshev, Zend Software Architect
[EMAIL PROTECTED]   http://www.zend.com/
(408)253-8829   MSN: [EMAIL PROTECTED]

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to