Namespace Question
Posted: Fri Jul 03, 2009 8:15 am
Good Day
I am messing around with the new stuff in the php5.3.0 release, specifically namespaces.
namespace.php
useNamespace.php
I am getting an error in useNamespace.php when trying to create a new object of the class in my namespace.
I am messing around with the new stuff in the php5.3.0 release, specifically namespaces.
namespace.php
Code: Select all
<?php
namespace Pro7\Amphibian;
class evolution
{
function connect($dbConn)
{
return $dbConn;
}
}
$evolution = new evolution; // za\co\pro7\amphibian\evolution
var_dump($evolution);
$namespace = __NAMESPACE__;
echo "\n\$namespace:$namespace\n";
$connect = $evolution-> connect("mysql");
echo "\$connect:$connect\n";
?>Code: Select all
<?php
use Pro7\Amphibian\evolution as evolution;
$obj = new evolution;
?>
I am not sure what I am doing incorrectly. I think that my concept of the global availability of the namespace might be incorrect.C:\php5.3.0>php useNamespace.php
PHP Fatal error: Class 'Pro7\Amphibian\evolution' not found in C:\php5.3.0\useN
amespace.php on line 4