You are here: Re: Functions and defaults « PHP Programming Language « IT news, forums, messages
Re: Functions and defaults

Posted by Andy Hassall on 06/19/06 23:23

On Mon, 19 Jun 2006 19:16:06 -0400, Bob Stearns <rstearns1241@charter.net>
wrote:

>Andy Hassall wrote:
>> On Mon, 19 Jun 2006 17:50:52 -0400, Bob Stearns <rstearns1241@charter.net>
>> wrote:
>>
>>>Consider a function header:
>>>
>>>function init($name, $ttl, $need_bhid="N", $need_entity_id="N")
>>>
>>>What values do the last two parameters have when it is called with the
>>>following arguments:
>>>
>>>init("name", "do name",,"Y");
>>
>> That's a syntax error.
>
>That is too bad. It really should be "N" and "Y" with PHP honoring the
>default values for all omitted arguments, not just trailing ones. Does
>PHP v 5.x do it better?

No, C++-style skipping arguments in the middle of a list of arguments with
defaults is not supported in any current version of PHP.

(I don't know whether will be or not in PHP 6).
--
Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

 

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

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