Re: Function Var or No Var
| From: | Cynic | Date: | Fri, 05 Jan 2001 12:00:00 +0000 |
| Subject: | Re: Function Var or No Var | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-32873@lists.php.net to get a copy of this message | ||
function functionname()
{
if( 0 < func_num_args ) {
$arg = func_get_arg( 0 ) ;
} else {
...
}
At 12:48 5.1. 2001, Hsieh Wen-Yang wrote the following:
--------------------------------------------------------------
>function functionname($arg=dafaultvalue) {
>....
>}
>
>----- Original Message -----
>From: "Abe Asghar" <abe@fish.tm>
>To: "PHP LIST" <php-general@lists.php.net>
>Sent: Friday, January 05, 2001 3:42 AM
>Subject: [PHP] Function Var or No Var
>
>
>Hey guys,
>
>I have a function in an external file. It is a footer function and is
>called on many pages. Now I want to pass it a varible from only one or two
>pages. However the problem is that I want to pass it a variable from one
>page and not from other pages e.g.
>
>1.
>DisplayFooter();
>
>and
>
>2.
>DisplayFooter($currentpage);
>
>The function is set up to recieve the variable - doing this I get a warning
>message where it is not sent a variable as in example 1.
>
>Is there a way to have a function that can take a variable and not produce
>an error or have a default value if not sent a varible or value.
>
>Thanks for any help.
>
>Abe
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
>For additional commands, e-mail: php-general-help@lists.php.net
>To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
>For additional commands, e-mail: php-general-help@lists.php.net
>To contact the list administrators, e-mail: php-list-admin@lists.php.net
------end of quote------
____________________________________________________________
Cynic:
A member of a group of ancient Greek philosophers who taught
that virtue constitutes happiness and that self control is
the essential part of virtue.
cynic@mail.cz