You are here: Re: Creating optional arguments « PHP Programming Language « IT news, forums, messages
Re: Creating optional arguments

Posted by scott Johnson on 11/20/92 11:29

Just a side note that you probably aready might know(im not always too
bright).
If you have more then one 'optional' argument:
function dosomething($var1, $var2='value2', $var3='somevalue')

They must be used in order. So if you need value3, you will need to fill
value2 also.

Siv Hansen wrote:
> Mazin07 wrote:
>
>> Let's say I have
>>
>> function dosomething ($var1, $var2, $var3) {
>>
>> ...
>>
>> }
>>
>> How do I make $var3 optional so that I can pass only 2 arguments and
>> still have it work?
>
>
>
> function dosomething($var1, $var2, $var3='somevalue'){
> ..
> }

 

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

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