Re: PHP 4.0 Bug #3759: 'unset' function argument keyword doesn't work?
| From: | Flavien LEBARBE | Date: | Wed, 08 Mar 2000 09:29:08 +0000 |
| Subject: | Re: PHP 4.0 Bug #3759: 'unset' function argument keyword doesn't work? | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-16529@lists.php.net to get a copy of this message | ||
> function myfunc( $arg=unset )
> {
> echo $arg."<br>\n";
> }
>
> myfunc( );
> myfunc( 'Hello, world.' );
>
> This version gives me:
>
> Parse error: parse error in /www/htdocs/test.html on line 7
The problem is the ambiguity between the string "unset" and
the unset function (yes, there is one!).
You can do it this way :
function myfunc ($arg='unset')
Since "unset" is a reserved keyword, it looks fair to me to
have to enclose it into quotes if you want it to be considered
as a string.
Flavien Lebarbé,
--
open Care.