473,377 Members | 1,119 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,377 software developers and data experts.

Functions and defaults

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");
Jun 19 '06 #1
4 1111
On Mon, 19 Jun 2006 17:50:52 -0400, Bob Stearns <rs**********@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.
--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Jun 19 '06 #2
Andy Hassall wrote:
On Mon, 19 Jun 2006 17:50:52 -0400, Bob Stearns <rs**********@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?
Jun 19 '06 #3
On Mon, 19 Jun 2006 19:16:06 -0400, Bob Stearns <rs**********@charter.net>
wrote:
Andy Hassall wrote:
On Mon, 19 Jun 2006 17:50:52 -0400, Bob Stearns <rs**********@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 :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Jun 19 '06 #4
Andy Hassall wrote:
On Mon, 19 Jun 2006 19:16:06 -0400, Bob Stearns <rs**********@charter.net>
wrote:

Andy Hassall wrote:
On Mon, 19 Jun 2006 17:50:52 -0400, Bob Stearns <rs**********@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).

Put me down for a positive vote if one is being taken :-)
Jun 19 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Kay Schluehr | last post by:
Since George Sakkis proposed a new way of doing list comprehensions http://groups-beta.google.com/group/comp.lang.python/browse_frm/thread/ac5023ad18b2835f/d3ff1b81fa70c8a7#d3ff1b81fa70c8a7 ...
2
by: Paul Davis | last post by:
I've just converted from gcc2.96 to gcc3.3. One of the things that 3.3 complained about was my use of functions which had default arguments. Previously, I put the defaults in my function...
16
by: Bhushit Joshipura | last post by:
This post contains one question and one proposal. A. May I know why order of evaluation of arguments is not specified in C/C++? I asked a question in comp.lang.c++ for the following...
10
by: serge | last post by:
I am doing a little research on Google about this topic and I ran into this thread: ...
8
by: btober | last post by:
I'm finding that column defaults are not being assigned to nulls when I do an insert by way of a an ON INSERT rule on a view. For example, the following script \set ON_ERROR_STOP ON \c...
25
by: Russell | last post by:
I want my code to be Python 3000 compliant, and hear that lambda is being eliminated. The problem is that I want to partially bind an existing function with a value "foo" that isn't known until...
5
by: krishnaroskin | last post by:
Hey all, I've been running into a problem with default values to template'd functions. I've boiled down my problem to this simple example code: #include<iostream> using namespace std; //...
31
by: Michael | last post by:
Why are functions atomic? (I.e. they are not copied.) For example, I would like to make a copy of a function so I can change the default values: (2, 2) I would like the following...
20
by: veebhudhi.chandramouli | last post by:
Instead of using same name i can use different name, is there any specific purpous is there to define the polymorphic overloaded functions in c#
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.