views:

952

answers:

0

I'm wondering how autoload will work with the namespace in PHP 5.3. Has anyone with 5.3 tested this?

Do you have to include a file before you can use its namespace? Or will the class name be given with namespaces to autoload?

Will these examples work correctly?

//file My\Some\Object1.php is not included yet
$obj1 = new My\Some\Object1();

//file My\Other\Object2.php is not included yet
use My\Other\Object2;
$obj2 = new Object2();

//file My\Functions\Array.php is not included yet
use My\Functions\Array as ArrayFunctions;
$array = ArrayFunctions\flatten($arr); //function

Closing this. Its answered here. Examples 1 and 2 should work, example 3 (the function) would not work as you cant autoload namespace, only classes.