What is namespaces in PHP?

by trycia.jones , in category: Technology , 3 years ago

What is namespaces in PHP?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by kenny , 3 years ago

PHP Namespaces provide a way of grouping related classes, interfaces, functions and constants.

1
2
3
4
5
6
# define namespace and class in namespace
namespace Modules\Admin\;
class CityController {
}
# include the class using namesapce
use Modules\Admin\CityController ;