Created
October 21, 2012 03:57
-
-
Save aredridel/3925620 to your computer and use it in GitHub Desktop.
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
include "MyStuff_MyClass.php"; | |
include "MyClass.php"; | |
new MyStuff\MyClass(); // prints "mine"; | |
new \MyClass(); // prints "global"; | |
new MyClass(); // Prints "global"; |
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
include "MyStuff_MyClass.php"; | |
include "MyClass.php"; | |
use MyStuff; | |
new MyStuff\MyClass(); // prints "mine"; | |
new \MyClass(); // prints "global"; | |
new MyClass(); // Prints "mine"; |
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
class MyClass { | |
function __construct() { echo "global"; } | |
} |
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 MyStuff { | |
class MyClass { | |
function __construct() { echo "mine"; } | |
} | |
} | |
new MyClass(); // prints "global"; | |
new MyStuff\MyClass(); // prints "mine"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment