<?php
require_once('../namespaces.php');
/*
// * basics examples to understand some functionalities :
// * we create 5 namespaces:
$__[1]='test1';
$__[2]='test2';
$__[3]='test3';
$__[4]='test4';
$_ENV['__NAMESPACES__'][5]='test5';
// * this do nothing:
//use_namespace('5');
// * this load the namespace 'test5':
use_namespace(5);
// * this show the current namespace:
var_dump($__->current());
// * this load the namespace 'test2':
use_namespace('test2');
// * another method to show the current namespace:
var_dump(current($__));
*/
include_to_namespace('test1.php','test1');
$var = new test();
$var->sh();
var_dump($var);
include_to_namespace('test2.php','test2');
$var = new test();
$var->sh();
var_dump($var);
/*
* Change the value of namespaces::$static to see the difference
*/
//namespaces::$static = true;
use_namespace('test1');
$var = new test2_test();
$var->sh();
//take care if namespaces::$static is false:
//$var->obj is not an object of class test1_test1 is an object of class test1 that extend _abstractClass
//as it's not in the global scope (it's a private property) you can't rename it and access directly to the object
//which is in reality $var->obj->_this. In some case it can be a source of bug.
renameObj(); //do nothing, already called with method sh()
var_dump($var,$__);
?>
|