PHP NAMESPACES

Sugar babies

PHP NAMESPACES

  • They allow for better organization by grouping classes that work together to perform a task.
  • They allow the same name to be used for more than one class.
  • In the broadest definition namespaces are a way of encapsulating items. 
  • This can be seen as an abstract concept in many places.
  • For example, in any operating system directories serve to group related files, and act as a namespace for the files within them.

EXAMPLE FOR NAMESPACES IN PHP :

<?php
echo "Hello World!";
namespace Html;
...
?>
OUTPUT :
Hello World!
Tags
Our website uses cookies to enhance your experience. Learn More
Accept !

GocourseAI

close
send