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);
.... 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.
***************************** 9 2374
My suggestion would be to reorganise the order in which the function takes
it arguments. Simply change it so that the 7th argument is the 5th, and the
5th and 6th argumentss become the 6th and 7th.
That's what I'd do at least. HTH
"Chuck Anderson" <we************@seemy.sig> wrote in message
news:ho********************@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);
... 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. *****************************
Aidan wrote: My suggestion would be to reorganise the order in which the function takes it arguments. Simply change it so that the 7th argument is the 5th, and the 5th and 6th argumentss become the 6th and 7th.
That's what I'd do at least. HTH
Well, yes, that would work. I can even supply the 5th and 6th arguments
in this case, but I was wondering if that really is something that Php
does not allow (the ,,, - method of skipping arguments) or if I need to
look closer for another parse error. "Chuck Anderson" <we************@seemy.sig> wrote in message news:ho********************@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);
... 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. *****************************
--
*****************************
Chuck Anderson • Boulder, CO http://www.CycleTourist.com
Integrity is obvious.
The lack of it is common.
*****************************
"Chuck Anderson" <we************@seemy.sig> wrote in message
news:Cs********************@comcast.com... Aidan wrote:
My suggestion would be to reorganise the order in which the function takes it arguments. Simply change it so that the 7th argument is the 5th, and the 5th and 6th argumentss become the 6th and 7th.
That's what I'd do at least. HTH Well, yes, that would work. I can even supply the 5th and 6th arguments in this case, but I was wondering if that really is something that Php does not allow (the ,,, - method of skipping arguments) or if I need to look closer for another parse error.
Well, the method you're using is essentially (to the best of my knowledge)
passing null values to the arguments you're trying to skip. Here's a page
from php.net I think you should read: http://au3.php.net/manual/en/functio...iable-arg-list
HTH "Chuck Anderson" <we************@seemy.sig> wrote in message news:ho********************@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);
... 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. *****************************
-- ***************************** Chuck Anderson • Boulder, CO http://www.CycleTourist.com Integrity is obvious. The lack of it is common. *****************************
"Aidan" <no***********@gmail.com> wrote in message
news:ne********************@titan.linknet.com.au.. . "Chuck Anderson" <we************@seemy.sig> wrote in message news:Cs********************@comcast.com... Aidan wrote:
My suggestion would be to reorganise the order in which the function takes it arguments. Simply change it so that the 7th argument is the 5th, and the 5th and 6th argumentss become the 6th and 7th.
That's what I'd do at least. HTH Well, yes, that would work. I can even supply the 5th and 6th arguments in this case, but I was wondering if that really is something that Php does not allow (the ,,, - method of skipping arguments) or if I need to look closer for another parse error.
Well, the method you're using is essentially (to the best of my knowledge) passing null values to the arguments you're trying to skip. Here's a page from php.net I think you should read:
http://au3.php.net/manual/en/functio...iable-arg-list
HTH
Ahh, try this link: http://php.net/manual/en/functions.arguments.php
"Chuck Anderson" <we************@seemy.sig> wrote in message news:ho********************@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);
... 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. *****************************
-- ***************************** Chuck Anderson . Boulder, CO http://www.CycleTourist.com Integrity is obvious. The lack of it is common. *****************************
"Chuck Anderson" <we************@seemy.sig> wrote in message
news:ho********************@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
function myfunction(arg1, arg2, arg3, arg4, arg5="", arg6="", arg7)...
Where "" should be set to the default values. ... 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. *****************************
Aidan wrote: "Aidan" <no***********@gmail.com> wrote in message news:ne********************@titan.linknet.com.au. ..
"Chuck Anderson" <we************@seemy.sig> wrote in message news:Cs********************@comcast.com...
Aidan wrote: My suggestion would be to reorganise the order in which the function takes it arguments. Simply change it so that the 7th argument is the 5th, and the 5th and 6th argumentss become the 6th and 7th.
That's what I'd do at least. HTH Well, yes, that would work. I can even supply the 5th and 6th arguments in this case, but I was wondering if that really is something that Php does not allow (the ,,, - method of skipping arguments) or if I need to look closer for another parse error.
Well, the method you're using is essentially (to the best of my knowledge) passing null values to the arguments you're trying to skip. Here's a page from php.net I think you should read:
http://au3.php.net/manual/en/functio...iable-arg-list
HTH
Ahh, try this link: http://php.net/manual/en/functions.arguments.php
I have read those pages about functions and function arguments from the
manual, but I can't find any indication about whether arguments can be
skipped in the call to the function, as I cited above. It discusses
setting a default value of NULL in the function definition, but I don't
see it addressing skipping arguments in the function call. It says to
put the arguments with default values on the right side, and then it
sort of implies that you may not be able to leave out arguments.
I'm not sure where I learned the ",,," syntax for skipping arguments
(C?), but I'm beginning to think that Php simply does not support it.
I could use Variable-length argument lists, but I didn't want to go there.
"Chuck Anderson" <we************@seemy.sig> wrote in message news:ho********************@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); > >... 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.
*****************************
Jamie Meyers wrote: "Chuck Anderson" <we************@seemy.sig> wrote in message news:ho********************@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.
*****************************
On Wed, 08 Jun 2005 19:06:52 -0600, Chuck Anderson <we************@seemy.sig>
wrote: 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);
... 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?
It's not allowed.
One alternative if you want to skip any argument and you can't rearrange the
skippable ones all towards the end is to pass an associative array instead,
which make it looks like named parameters from other languages, e.g.:
myfunction(array(
arg2 => 'wibble',
arg6 => 'wobble'
));
--
Andy Hassall / <an**@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
Andy Hassall wrote: On Wed, 08 Jun 2005 19:06:52 -0600, Chuck Anderson <we************@seemy.sig> wrote: 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);
... 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?
It's not allowed.
One alternative if you want to skip any argument and you can't rearrange the skippable ones all towards the end is to pass an associative array instead, which make it looks like named parameters from other languages, e.g.:
myfunction(array( arg2 => 'wibble', arg6 => 'wobble' ));
Thanks. Yes, ... I can make "other arrangements." I just wanted to be
sure that was "illegal" before I wrote off ever trying it again.
--
*****************************
Chuck Anderson • Boulder, CO http://www.CycleTourist.com
Integrity is obvious.
The lack of it is common.
***************************** This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Geoff Bennett |
last post by:
While parsing an XML document, my TextReader instance skips nodes. For
example, in this fragment:
<Person Sex="Male" FirstHomeBuyer="No" YearsInCurrentProfession="14">
<RelatedEntityRef...
|
by: deko |
last post by:
I'd like to use a bit of code in the OnOpen event of a report:
=rptOpen(Me.ReportName), (Me.Tag) --this doesn't work
This does work:
Private Sub Report_Open(Cancel As Integer)...
|
by: Melkor Ainur |
last post by:
Hello,
I'm attempting to build an interpreter for a pascal-like language.
Currently, I don't generate any assembly. Instead, I just build an
abstract syntax tree representing what I've parsed...
|
by: John Devereux |
last post by:
Hi,
I would like to know if their is a conversion specifier, or other
method, that will allow me to not use particular arguments to printf.
Failing that, is it permissable to simply "not use"...
|
by: dragoncoder |
last post by:
Consider the following code.
#include <stdio.h>
int main()
{
int i =1;
printf("%d ,%d ,%d\n",i,++i,i++);
return 0;
}
|
by: Csaba Gabor |
last post by:
Inside a function, I'd like to know the call stack. By this I mean
that I'd like to know the function that called this one, that one's
caller and so on.
So I thought to do:
<script...
|
by: pozz |
last post by:
Is there some modifier that skips a parameter of a printf?
For example, I pass three parameters:
printf( <format string>, '-', value/10, value%10 );
In certain cases I want to print the minus...
|
by: Gustaf |
last post by:
Hi all,
Just for fun, I'm working on a script to count the number of lines in source files. Some lines are auto-generated (by the IDE) and shouldn't be counted. The auto-generated part of files...
|
by: ADezii |
last post by:
When a call is made to a Sub or Function Procedure, you can supply Arguments in the exact order they appear in the Procedure's definition, or you can supply them in any position by name. To...
|
by: DJRhino |
last post by:
Was curious if anyone else was having this same issue or not....
I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
|
by: Aliciasmith |
last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
|
by: tracyyun |
last post by:
Hello everyone,
I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
|
by: Teri B |
last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course.
0ne-to-many. One course many roles.
Then I created a report based on the Course form and...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM)
Please note that the UK and Europe revert to winter time on...
|
by: nia12 |
last post by:
Hi there,
I am very new to Access so apologies if any of this is obvious/not clear.
I am creating a data collection tool for health care employees to complete. It consists of a number of...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
|
by: isladogs |
last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, Mike...
| |