You are here: Re: [PHP] Skipping function arguments! « PHP « IT news, forums, messages
Re: [PHP] Skipping function arguments!

Posted by Vedanta Barooah on 04/28/05 16:47

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 <vedanta.barooah@gmail.com> 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 timelimit [, int deref]]]]])
>
> if you look at the 4th and the 6th arguments to the function
> attributes is an array while sizelimit is an int, i want to pass the
> sixth element without passing the 4th and the 5th ... how do i do
> that??
>
> i tried these options:
>
> # this does not work,
> $rs=ldap_search($con,"o=vodoo.com","(objectClass*)",array(),0,500);
>
> # this wont works :((
> $rs=ldap_search($con,"o=vodoo.com","(objectClass*)",' ',0,500);
>
> # this also goofs!
> $rs=ldap_search($con,"o=vodoo.com","(objectClass*)",NULL,0,500);
>
> here that 5th arg works if i pass a zero as ... 0 means the default behaviour!!
>
> any ideas ... clues ?
>
> Thanks,
> Vedanta Barooah
>
>
> On 4/28/05, Marek Kilimajer <lists@kilimajer.net> wrote:
> > 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 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 this using:
> > >>
> > >>function add($a = null,$b = null, $c = null){
> > >> if(is_null($a)) $a = 1;
> > >> if(is_null($b)) $b = 2;
> > >> if(is_null($c)) $c = 3;
> > >> return $a + $b + $c;
> > >>}
> > >>
> > >>add(1, null, 1);
> > >
> > >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
> --
> *~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~*
> Vedanta Barooah
> YM! - vedanta2006
> Skype - vedanta2006
>


--
*~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~*
Vedanta Barooah
YM! - vedanta2006
Skype - vedanta2006

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация