Thanx for the idea, but associative arrays don't cut it i'm afraid. This way, i need to validate much more data, and i lose the ability to define default values for parameters.
I was just asking because i faced the following situation:
function foo($a, $b='', $c='') { //code }.
I want to call the previous function, but only pass it the parameters $a and $c, and keep $b to the default value without having to explicity state that. This is not possible in PHP, and i was wondering if there was some kind of a workaround. Calling by name certainly solves that problem but if it's not available, i guess i have to find another workaround.
On 10/29/06, Ammar Ibrahim <[EMAIL PROTECTED]
> wrote:
Call by name is a language feature which can't be implemented by an external class or Library, unless it hooks to the Zend engine. anyhow, you can emulate this feature with a simple associatve array:
function foo( $args ){
//........
}
//calling the function
$return = foo( array('num'=>5, 'children'=>10) );
- AmmarOn 10/29/06, Al-Faisal El-Dajani <[EMAIL PROTECTED]> wrote:Hey guys,
I have been searching for a while, but i don't seem to be able to find a way that allows me to call parameters by name in PHP. I know that PHP doesn't support it, but isn't there some class or library that would allow me to do that?
Thanx
--
Al-Faisal El-Dajani
Tel: +962-7-77 799 781
P.O Box: 140056
11814 Amman, Jordan
--
Al-Faisal El-Dajani
Tel: +962-7-77 799 781
P.O Box: 140056
11814 Amman, Jordan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Jordan PHP Users Group" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/JoPHP
http://Jolug.org/
-~----------~----~----~----~------~----~------~--~---
