Last active
January 9, 2019 15:34
-
-
Save olehi94/a12aa9d0a473086289cece5654051af3 to your computer and use it in GitHub Desktop.
Example using namespaces.
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 | |
use Lib\Eddard as AnotherEddard; | |
class Eddard { | |
public static function whoAmI() { | |
return 'It\'s method whoAmI in index.php.'; | |
} | |
} | |
require_once 'lib.php'; | |
$edd1 = new Eddard(); | |
echo $edd1::whoAmI() . '<br>'; | |
$edd2 = new AnotherEddard(); | |
echo $edd2::whoAmI(); |
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 Lib; | |
class Eddard { | |
public static function whoAmI() { | |
return 'It\'s method whoAmI in lib1.php.'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment