note 70651 deleted from language.oop5 by colder

From: Date: Sun, 19 Aug 2007 23:36:07 +0000
Subject: note 70651 deleted from language.oop5 by colder
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-129600@lists.php.net to get a copy of this message
Note Submitter: DTcorp dot 2004 at gmail dot com ---- It's easy to create a simple emulation of the namespaces or packages support available in java, c++, etc... <?php class myPackage { public function myPublicClassEmu() { $this->myPrivateClassEmu(); } private function myPrivateClassEmu() { $this->myProtectedClassEmu(); } protected function myProtectedClassEmu() { function myPrivateFunction() { echo 'test'; } return myPrivateFunction(); } } $MyPackage = new myPackage(); // or: new myPackage $MyPackage->myPublicClassEmu(); ?> This will output: test Off course this isn't the same as the namespaces in C++, but does provide the same functionality idea

« previous php.notes (#129600) next »