PHP_Func
| From: | Aidan Lister | Date: | Mon, 26 Apr 2004 14:18:26 +0000 |
| Subject: | PHP_Func | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-28371@lists.php.net to get a copy of this message | ||
I was thinking to myself, why doesn't PEAR have a set of functions that
everyone, for every project ends up rewriting? Surely that's what we're
about here, reusability.
include 'function.microtime_str.php'; // tell me you haven't recreated this
function at least 100 times
http://ircphp.com/users/imho/?file=function.microtime_str.php
Then I was thinking, well, why stop there - why not introduce
implementations of functions that are lacking in older versions of php - god
knows the PHP Manual is full of them.
For example,
http://ircphp.com/users/imho/?file=function.scandir.php
http://ircphp.com/users/imho/?file=function.file_get_contents.php
http://ircphp.com/users/imho/?file=function.file_put_contents.php
Then lsmith said "why not put them in a class", and immediately my brain
started ticking.
PHP_Func, a class for extending and replacing basic PHP functionality. All
functions would be abstract, and called as such.
eg. PHP_Func::file_get_contents();
In a PHP5 implementation, the __get method could be used for a factory
pattern.
Anyway, that's my idea... I'd love any feedback, whether people think it's a
good idea, etc.
Thanks,
Aidan