Re: Procedural Autoloader?
| From: | Daniel P. Brown | Date: | Mon, 22 Nov 2010 21:40:07 +0000 |
| Subject: | Re: Procedural Autoloader? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-309626@lists.php.net to get a copy of this message | ||
On Mon, Nov 22, 2010 at 16:31, Nathan Nobbe <quickshiftin@gmail.com> wrote:
>
> Shrug, if you want to really be dirty about it, you could just put a 'class'
> atop each file of functions.
> <?php
> class IWishTheseFunctionsWereOOInstead {} // :P
> function firstProceeduralFunc() {
> // ..
> }
> ?>
That's not going to be economical or allow him to autoload,
though, because the autoloader is called when the class is
instantiated. Prune could instantiate it thusly:
<?php
$foo = new IWishTheseFunctionsWereOOInstead();
firstProceeduralFunc(); // [sic]
?>
.... but it would be just as simple to do:
<?php
require dirname(__FILE__).'/includes/function.php';
firstProceeduralFunc(); // [sic, again]
?>
--
</Daniel P. Brown>
Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting
(866-) 725-4321
http://www.parasane.net/