On Mon, Nov 22, 2010 at 2:24 PM, Daniel P. Brown
<daniel.br...@parasane.net>wrote:

> On Mon, Nov 22, 2010 at 15:37, Jason Pruim <li...@pruimphotography.com>
> wrote:
> > Hey Everyone!
> >
> > Fresh off my problem with functions and arrays I come across something
> that
> > I can't seem to find currently... The autoloader function that is in PHP
> 5+
> > works on classes... But I'm not finding anything that would do the same
> > thing on the procedural end... Such as I have a folder typically called
> > includes in my projects where I place all my function files... I would
> LOVE
> > to use the autoloader to be able to just load them on demand... But in my
> > quick searching/thinking I haven't found away too... So I thought I would
> > see if anyone had invented that wheel yet before I go and try and do it
> my
> > self :)
> >
> > I may also have a misunderstanding of how it is supposed to work since I
> > don't truly understand OOP I've always done procedural...
> >
> > Any help on this one would be greatly appreciated it! :)
>
>     There's no such thing, Prune.  Autoloaders are for classes, and
> the only way you could have it work for functions would be to catch
> the error in the core and handle it at a lower level than your scripts
> (modified core or extension), because the error generated for an
> undefined function isn't a catchable fatal.  Alternatively, you
> *could* write a function wrapper that utilizes function_exists() and
> the like, then rewrite all of your code to use that wrapper.... but
> how much sense does that make?  ;-P


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() {
 // ..
}
?>

-nathan

Reply via email to