You are here: Re: skipping arguments in function call « PHP Programming Language « IT news, forums, messages
Re: skipping arguments in function call

Posted by Chuck Anderson on 06/09/05 22:29

Jamie Meyers wrote:

>"Chuck Anderson" <websiteaddress@seemy.sig> wrote in message
>news:houdnQf0jJq5CzrfRVn-hw@comcast.com...
>
>
>>I have a function with 7 inputs. The last three have default values.
>>
>>I want to call that function specifying the first four, skip two and then
>>specify the last.
>>
>>I thought I could write this as :
>>
>>$retval = myfunction(arg1, arg2, arg3, arg4,,,arg7);
>>
>>
>
>if you wrote myfunction, then declare it like this
>
>
I did write it.

>function myfunction(arg1, arg2, arg3, arg4, arg5="", arg6="", arg7)...
>Where "" should be set to the default values.
>
>
That's actually something the manual says not to do. It says all default
arguments should be on the right and then has an example showing why it
won't work the other way.

My arg 7 has a default value, though, so you're structure is how it
already exists.

>
>
>>... but Php does not seem to want to let me do this. I get a parse error
>>until I supply values for the 5th and 6th arguments.
>>
>>My question is simply this; is skipping arguments like that not allowed in
>>Php?
>>
>>
>>

--
*****************************
Chuck Anderson • Boulder, CO
http://www.CycleTourist.com
Integrity is obvious.
The lack of it is common.
*****************************

 

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

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