Last active
August 29, 2015 14:27
-
-
Save jgrossi/6f9e9a90925c913cf4fa to your computer and use it in GitHub Desktop.
PHP Namespace for functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace { // default namespace | |
function foo() | |
{ | |
return 'foo function'; | |
} | |
} | |
namespace company { // company namespace | |
function foo() | |
{ | |
return 'company foo function'; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1><?php echo foo() ?></h1> | |
<h1><?php echo company\foo() ?></h1> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment