Skip to content

Instantly share code, notes, and snippets.

@harikt
Created December 4, 2010 09:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save harikt/728060 to your computer and use it in GitHub Desktop.
Save harikt/728060 to your computer and use it in GitHub Desktop.
<?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";
}
}
<?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();
@harikt
Copy link
Author

harikt commented Dec 4, 2010

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 ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment