Skip to content

Instantly share code, notes, and snippets.

@RufusTJohnson
Last active August 1, 2018 03:37
Show Gist options
  • Select an option

  • Save RufusTJohnson/f7d32742656dc34942c81218b512d1e2 to your computer and use it in GitHub Desktop.

Select an option

Save RufusTJohnson/f7d32742656dc34942c81218b512d1e2 to your computer and use it in GitHub Desktop.
Demonstrate How Namespaces Affect Fully Qualified Classnames
<?php
namespace This\Is\A\Long\Name_Space;
echo '<span style="text-decoration: underline;">Demo the effect of namespaces on fully qualified class names</span>';
class handler{}
// Post the fully qualified name of the handler class defined in this namespace
echo "<br><br><HR>".handler::class."<br>";
namespace Short\Name_Space;
class handler{}
// Post the fully qualified name of the handler class defined in this namespace
echo "<br><br><HR>".handler::class."<br>";
?>
Output
------
Demo the effect of namespaces on fully qualified class names
This\Is\A\Long\Name_Space\handler
Short\Name_Space\handler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment