PHP: Namespacing
<?php
namespace myNamespace;
class DateTime{
public function customMethod(){
return 'Fun Times';
}
}
/*
* Create a new DateTime object that's in this current namespace
* If we are outside this namespace we can create it by:
* $customDate = new \myNamespace\DateTime();
*/
$customDate = new DateTime();
echo $customDate->customMethod();
/* We can still create the default DateTime object */
$standardDate = new \DateTime();
echo $standardDate->format('Y-m-d H:i:s');
?>