note 87864 added to language.oop5.autoload
| From: | zack_gold at yahoo dot com | Date: | Sat, 27 Dec 2008 22:27:37 +0000 |
| Subject: | note 87864 added to language.oop5.autoload | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-148588@lists.php.net to get a copy of this message | ||
I found out a neat way to centralize one single class which will give accessibility to other
classes.
[php]<?php
class Bot {
private $classes = array (
'Socket' => "connection/class.Socket.php",
'Input' => "io/class.Input.php",
'Output' => "io/class.Output.php",
'Parse' => "io/parse/class.Parse.php"
);
public $Socket, $Input, $Output, $Parse; // Accessible by other classes
public function __construct(){
foreach($this->classes as $class => $path){
require($path);
$this->$class = new $class($this);
}
}
}
?>[/php]
----
Server IP: 64.71.164.2
Probable Submitter: 76.103.145.92
----
Manual Page -- http://www.php.net/manual/en/language.oop5.autoload.php
Edit -- https://master.php.net/note/edit/87864
Del: integrated -- https://master.php.net/note/delete/87864/integrated
Del: useless -- https://master.php.net/note/delete/87864/useless
Del: bad code -- https://master.php.net/note/delete/87864/bad+code
Del: spam -- https://master.php.net/note/delete/87864/spam
Del: non-english -- https://master.php.net/note/delete/87864/non-english
Del: in docs -- https://master.php.net/note/delete/87864/in+docs
Del: other reasons-- https://master.php.net/note/delete/87864
Reject -- https://master.php.net/note/reject/87864
Search -- https://master.php.net/manage/user-notes.php