PHP Classes

File: example.nsim.php

Recommend this page to a friend!
  Classes of Martin Alterisio   NamespaceSim   example.nsim.php   Download  
File: example.nsim.php
Role: Example script
Content type: text/plain
Description: nsim example file
Class: NamespaceSim
Emulate class namespaces under PHP 5
Author: By
Last change: Version 0.5.0
Date: 17 years ago
Size: 598 bytes
 

Contents

Class file image Download
<?php
/**
 * @ignore
 * @package ignore
 */

import TestNamespace;

echo
TestClass::$test;

echo
1/0;

$testFunction = 'testStatic';
TestClass::
$testFunction('Hi World!');

trigger_error('Ouch');

TestClass::testStatic('Hi World!');

$testClass = 'TestClass';
$test = new $testClass('Hi World!');
var_dump($test instanceof TestClass);

$test = new TestClass('Hi World!');
function
testTypeHinting(TestInterface $test, TestInterface $dummy, $dummy2 = TestClass::TEST_CONSTANT) {
   
$test->test();
}
testTypeHinting($test, $test);

echo
TestClass::TEST_CONSTANT;
?>