PHP Classes

File: test2.php

Recommend this page to a friend!
  Packages of Salvan Grégory   Namespaces   test2.php   Download  
File: test2.php
Role: Example script
Content type: text/plain
Description: required file for example
Class: Namespaces
Load classes from defined namespaces
Author: By
Last change: access
Date: 17 years ago
Size: 459 bytes
 

 

Contents

Class file image Download
<?php
echo "<p>file test2.php was loaded</p>";
class test {
    private $obj;
    function test() {
        $this->obj= new test1();
        echo "<p>new object of class 'test' from file 'test2.php' created</p>";
    }
    public function sh() {
        $this->obj->show();
    }
}
class test1 {
    private $text;
    function test1(){
        $this->text= "<p>new object of class 'test1' from file 'test2.php' created</p>";
    }
    public function show() {
        echo  $this->text;
    }
}
?>