Re: [PHP] Re: the most amazing php code i have ever seen so far

[email protected] ("Nathan Nobbe")
Newsgroups php.general
Message-ID <[email protected]>
On Thu, Apr 24, 2008 at 1:22 PM, Shawn McKenzie <[email protected]>
wrote:

> paragasu wrote:
>
>> i have seen many php code. i learn php on my own, and during early days
>> with
>> php,
>> i download many open source php project and try to learn the coding on my
>> own.
>> i did see many code (ugly, spaghetti code etc). Some even  take me few
>> hours to figure out
>> how it works.
>>
>> But one project using php in a very clean way. The codeis look so simple.
>> yet do so much thing.
>> Personally, i vote for www.eyeos.org project for the best php code.
>> Anyone
>> know better?
>>
>>
> First thing, after the sweeeet header comment that I saw was this:
>
>        call_user_func('lib_eyeString_start');
>
> I thought, why wouldn't you just do this:
>
>        lib_eyeString_start();
>
> Or maybe I'm missing something.  call_user_func() only seems to be useful
> if you have a variable function name that could be different for any call of
> the call_user_func():
>
>        call_user_func($funcNameAssignedEarlier);
>
> But still, this would be the same yes?
>
>        $funcNameAssignedEarlier();


i think your assessment is valid.  variable functions are great, there is
less overhead.  the benefit of call_user_func() is that it accepts the php
psuedo type 'callback' which allows client code to determine what 'type' of
function is used; a global function, a class instance function, or a class
static function.  in this case cycles are being thrown down the drain for
nothing :O

-nathan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.