Functional PHP Extension |
[eluser]Jamongkad[/eluser]
[quote author="Randy Casburn" date="1215481359"] From my point of view I would like to see this... One of the compelling nuances of this abstract approach (FP) is the possibility of providing the devs this awesome ability that JS has of dealing with abstract function arguments. By this I mean function arguments that aren't set into concrete at declaration. The dev can use function arguments in any order regardless of the function declaration, and use the arguments they chose and ignore the one's they choose not to use. Could you imagine a function like: Code: function label_new_if_today($date, $date_format="Y-m-d", $label="(New Project)") Being called thus: label_new_if_today($label="(Old Project)"); ? Or how about this... Code: function constructQuery($statement,$from,$where,$limit,$orderBy){ Then the beauty in the flexibility (that you so aptly see WiredByDesignz) would so grand it would undeniable. Unfortunately, no one has been able to achieve this with PHP. (AFAIK) ======= The rest of the theory is just academic to until a hard core WIIFM demonstration is provided. Randy[/quote] I have to agree to a certain extent that it is the limitations of the language itself. I guess this is the reason why this patch tries to solve it check it out here oh you need php5.3.0 and you need to recompile it. Much of a hassle I know but it allows you much of the same power that is afforded to you via JS. To answer your question about variable arguments to a function. I wrote a function that tries to at least capture the spirit of what you're looking for. Consider the example below Code: //Major functions in the library use the func_get_args() method as it allows us captures a number |
Messages In This Thread |
Functional PHP Extension - by El Forum - 07-06-2008, 08:30 PM
Functional PHP Extension - by El Forum - 07-06-2008, 11:59 PM
Functional PHP Extension - by El Forum - 07-07-2008, 12:15 AM
Functional PHP Extension - by El Forum - 07-07-2008, 12:48 AM
Functional PHP Extension - by El Forum - 07-07-2008, 12:58 AM
Functional PHP Extension - by El Forum - 07-07-2008, 01:20 AM
Functional PHP Extension - by El Forum - 07-07-2008, 01:44 AM
Functional PHP Extension - by El Forum - 07-07-2008, 07:51 AM
Functional PHP Extension - by El Forum - 07-07-2008, 07:55 AM
Functional PHP Extension - by El Forum - 07-07-2008, 08:32 AM
Functional PHP Extension - by El Forum - 07-07-2008, 09:53 AM
Functional PHP Extension - by El Forum - 07-07-2008, 10:15 AM
Functional PHP Extension - by El Forum - 07-07-2008, 02:42 PM
Functional PHP Extension - by El Forum - 07-07-2008, 07:27 PM
Functional PHP Extension - by El Forum - 07-07-2008, 10:19 PM
Functional PHP Extension - by El Forum - 07-07-2008, 10:53 PM
Functional PHP Extension - by El Forum - 07-08-2008, 09:10 AM
Functional PHP Extension - by El Forum - 07-08-2008, 11:21 AM
Functional PHP Extension - by El Forum - 07-08-2008, 06:33 PM
Functional PHP Extension - by El Forum - 07-08-2008, 07:02 PM
Functional PHP Extension - by El Forum - 07-10-2008, 11:13 PM
|