Created
December 4, 2010 09:45
-
-
Save harikt/728060 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
/* | |
Going through the slides of phparch OOP THE PHP 5.3 Way | |
http://www.phparch.com/2010/11/29/codeworks-2010-slides/ | |
A try at the example given by Marco Tabini. Some corrections was needed, just updated it ;) . | |
*/ | |
namespace Blueparabola; | |
class example { | |
public function sayHello() { | |
echo 'I am from ' . __CLASS__ . " . Yes namespace \n"; | |
} | |
} |
This file contains hidden or 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 | |
/* | |
Going through the slides of phparch OOP THE PHP 5.3 Way | |
http://www.phparch.com/2010/11/29/codeworks-2010-slides/ | |
A try at the example given by Marco Tabini. Some corrections was needed, just updated it ;) . | |
*/ | |
*/ | |
require "example.php"; | |
use Blueparabola\Example as MarcoExample; | |
class Example | |
{ | |
public function sayHello() { | |
echo 'From example ' . __CLASS__ . " inside use.php \n"; | |
} | |
} | |
$a = new Blueparabola\Example; | |
$a->sayHello(); | |
$b = new MarcoExample; | |
$b->sayHello(); | |
$c = new Example; | |
$c->sayHello(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
try in command line
$ php use.php
Yes you will definitely know how it works right ? ;) . ie so cool tutorial by @mtabini . Modified slightly by @harikt ;)