[PHP] Skipping function arguments!

2005-04-28 Thread Vedanta Barooah
Hello All, Cosider this : function add($a=1,$b=2,$c=3){ return $a + $b + $c; } how do i skip the second argument while calling the function, is there a process like this: echo add(1,,1); # where i expect 2 to be printed, how do i xcheive this m totally lost ! :(( Thanks, Vedanta

Re: [PHP] Skipping function arguments!

2005-04-28 Thread Marek Kilimajer
Vedanta Barooah wrote: Hello All, Cosider this : function add($a=1,$b=2,$c=3){ return $a + $b + $c; } how do i skip the second argument while calling the function, is there a process like this: echo add(1,,1); # where i expect 2 to be printed, php does not support this. you can workaround

Re: [PHP] Skipping function arguments!

2005-04-28 Thread Bostjan Skufca @ domenca.com
function add ($a=1, $b=2, $c=3) { return $a + $b + $c; } add(1, null, 1); will do just fine r., Bostjan On Thursday 28 April 2005 14:16, Marek Kilimajer wrote: Vedanta Barooah wrote: Hello All, Cosider this : function add($a=1,$b=2,$c=3){ return $a + $b + $c; }

Re: [PHP] Skipping function arguments!

2005-04-28 Thread Marek Kilimajer
Bostjan Skufca @ domenca.com wrote: function add ($a=1, $b=2, $c=3) { return $a + $b + $c; } add(1, null, 1); will do just fine returns 2, OP wants 4 IMO r., Bostjan On Thursday 28 April 2005 14:16, Marek Kilimajer wrote: Vedanta Barooah wrote: Hello All, Cosider this : function

Re: [PHP] Skipping function arguments!

2005-04-28 Thread Vedanta Barooah
Well that was simple, but this is what i am trying to solve: if you refer to the php documentation for ldap_open() function it says: resource ldap_search ( resource link_identifier, string base_dn, string filter [, array attributes [, int attrsonly [, int sizelimit [, int timelimit [, int

Re: [PHP] Skipping function arguments!

2005-04-28 Thread Vedanta Barooah
btw! saying: add($a=null,$b=null,$c=null) is as good as saying: add($a,$b,$c) thanks, vedanta On 4/28/05, Vedanta Barooah [EMAIL PROTECTED] wrote: Well that was simple, but this is what i am trying to solve: if you refer to the php documentation for ldap_open() function it says:

Re: [PHP] Skipping function arguments!

2005-04-28 Thread Jason Barnett
Vedanta Barooah wrote: btw! saying: add($a=null,$b=null,$c=null) is as good as saying: add($a,$b,$c) No, it's not. Because in this case $a, $b and $c are all uninitialized variables and (if this is a function definition) then you *have* to supply $a $b and $c parameters. Even if you were

Re: [PHP] Skipping function arguments!

2005-04-28 Thread Vedanta Barooah
the code below was talking of function declarations ... reffer to the thread. will code injection in case of function declarations work? I am not sure!! ;) ?php function add($a,$b,$c){ return $a+$b+$c ; } echo add(2,null,3); # even if you pass the value of $b in the url as

Re: [PHP] Skipping function arguments!

2005-04-28 Thread Jason Barnett
Please do not reply to me personally. I will usually read your responses in the newsgroup. Vedanta Barooah wrote: the code below was talking of function declarations ... reffer to the thread. will code injection in case of function declarations work? I am not sure!! OK. But even so

Re[2]: [PHP] Skipping function arguments!

2005-04-28 Thread Richard Davey
Hello Jason, Thursday, April 28, 2005, 3:25:10 PM, you wrote: JB ?php JB /** Page called with ?a=22 appended to URL */ JB function add($a,$b,$c) { JBreturn $a+$b+$c; JB } JB $total = add($first, $second, $third); JB /** You think this will be 0, but with register_globals this is actually

Re[3]: [PHP] Skipping function arguments!

2005-04-28 Thread Richard Davey
RD As that code stands, even with register globals on, it will not echo RD 22. At least on PHP 4.3.11 on my server this is the case. I guess RG RD makes all variables global, but not super-global, which leaves the RD above safe as the null of $total overrides whatever may have been set. Err,

Re: [PHP] Skipping function arguments!

2005-04-28 Thread Jason Barnett
Richard Davey wrote: RD As that code stands, even with register globals on, it will not echo RD 22. At least on PHP 4.3.11 on my server this is the case. I guess RG RD makes all variables global, but not super-global, which leaves the RD above safe as the null of $total overrides whatever may have

Re[2]: [PHP] Skipping function arguments!

2005-04-28 Thread Richard Davey
Hello Jason, Thursday, April 28, 2005, 4:23:43 PM, you wrote: JB Indeed... and replace ?a=22 with ?first=22 in my message as well. JB :-/ Heh.. ok :) No worries, demonstrated to me that RegGlobs aren't quite as destructive as popular myth would lead you to believe (not that it'll make me start

Re: [PHP] Skipping function arguments!

2005-04-28 Thread Jason Barnett
Richard Davey wrote: Hello Jason, Thursday, April 28, 2005, 4:23:43 PM, you wrote: JB Indeed... and replace ?a=22 with ?first=22 in my message as well. JB :-/ Heh.. ok :) No worries, demonstrated to me that RegGlobs aren't quite as destructive as popular myth would lead you to believe (not that

Re: [PHP] Skipping function arguments!

2005-04-28 Thread Marek Kilimajer
Vedanta Barooah wrote: Well that was simple, but this is what i am trying to solve: if you refer to the php documentation for ldap_open() function it says: resource ldap_search ( resource link_identifier, string base_dn, string filter [, array attributes [, int attrsonly [, int sizelimit [, int

Re: [PHP] Skipping function arguments!

2005-04-28 Thread Richard Lynch
On Thu, April 28, 2005 6:43 am, Vedanta Barooah said: resource ldap_search ( resource link_identifier, string base_dn, string filter [, array attributes [, int attrsonly [, int sizelimit [, int timelimit [, int deref]) if you look at the 4th and the 6th arguments to the function