<?php
namespace MyProject;
define('CONSTANT', 'asdf');
function mine() {
var_dump('mine');
}
function func() {
var_dump('func');
}
class CName {
function __construct() {
var_dump('__contruct');
}
static function method() {
var_dump('method');
}
}
namespace\mine(); // calls function MyProject\blah\mine()
namespace\func(); // calls function MyProject\func()
namespace\cname::method(); // calls static method "method" of class MyProject\cname
$a = new namespace\cname(); // instantiates object of class MyProject\sub\cname
$b = namespace\CONSTANT; // assigns value of constant MyProject\CONSTANT to $b
?>
string(4) "mine"
string(4) "func"
string(6) "method"
string(10) "__contruct"
Fatal error: Undefined constant 'MyProject\CONSTANT' in /in/6k2qd on line 37
Process exited with code 255.