PHP Classes

File: examples/runtestinclude.php

Recommend this page to a friend!
  Classes of Jorge Castro   PHP AutoLoad One   examples/runtestinclude.php   Download  
File: examples/runtestinclude.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP AutoLoad One
Generate scripts to autoload classes of a project
Author: By
Last change:
Date: 4 years ago
Size: 1,106 bytes
 

Contents

Class file image Download
<?php
namespace dummy;

// This example doesn't use autoload

include '../test/folder\NaturalClass.php';
include
'../test/folder/subfolder\AnotherNaturalClass.php';
include
'../test/folder/subfolder\AnotherNaturalClass2.php';
include
'../test/folder/subfolder\MoreNaturalClass.php';
include
'../test/folder/subfolderalt/CustomClass.php';
include
'../test/folder/multiplenamespace.php';
include
'../test/folder/subfolderalt/ClassWithoutNameSpace.php';

use
ClassWithoutNameSpace;



// basic
$c2=new \folder\NaturalClass();
// same folders
$c1=new \folder\subfolder\AnotherNaturalClass();
$c3=new \folder\subfolder\AnotherNaturalClass2();
$c4=new \folder\subfolder\MoreNaturalClass();
// same folder, again
$c4=new \folder\subfolder\MoreNaturalClass();
// same namespace, different folder
$c5=new \folder\subfolder\CustomClass();

// one file, two namespaces
$c6=new \MyProject\Connection();
$c8=new \AnotherProject\Connection();

// class without namespace
$c9=new ClassWithoutNameSpace();



echo
"Ok<br>";

echo
"the next command should raise an error:<br>";
$cE1 = new \folder\subfolder\CustomClassE();