What is namespaces
PHP introduce NAMESPACES in 5.3 version. Namespaces are virtual container/directory to organize code structure. In php we can not share same name for two classes. For example if you are using user management plugin for your project and this plugin contain User class for user verification. And also you have User class for user related activities in your application. If you include both file to access User class then PHP will throw error (Cannot redeclare class). To solve this problem we use Namespaces to organize or separate classes.
class User
{
public function login()
{
echo 'Login successfully using plugin';
}
Read full blog at our highly specific C, Java, PHP, Javascript, iPhone, PHP developer forum about the topic described above "PHP Namespace". You can also learn much more about different programming technologies and can enhance your tech skills.
No comments:
Post a Comment