Click here to Skip to main content
15,891,777 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi all,

I am learning of php, I don't know how can access namespace of sub-namespace?

Could you suggest me?

my code is:

<?php

namespace food
{
	class Cat
	{
		function says() 
		{
			echo 'Cat';
		}  
	}
}
?>
<?php
namespace good
{
	class Rat
	{
		function says() 
		{
			echo 'Rat';
		}  
	}
}

?> 

<?php

use food as foo;

$objs=new foo\Cat();

?>


could you tell me where I went wrong?

thanks in advance...................
Posted
Updated 11-Jul-13 23:29pm
v3

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900