Re: [PHP4BETA] Is use() a reserved function name?
| From: | Lars Torben Wilson | Date: | Thu, 16 Mar 2000 21:07:09 +0000 |
| Subject: | Re: [PHP4BETA] Is use() a reserved function name? | ||
| References: | 1 2 3 4 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-12282@lists.php.net to get a copy of this message | ||
Mikael Grave writes:
> Within a class, I define a function called use() and I got the following
> parser error:
>
> Parse error: parse error, expecting `T_STRING' in xxxx on line 561
>
> Here is my line 561:
>
> function use($path, $filename_param = "") {
> ...
> }
>
> (I can hardly rename it because it comes from a PHP3 application and it
> is widely used everywhere in my code...)
>
> Cordially,
>
> Mikael
> --
> Mikael Grave Tel. (613) 731-4046
> http://www.webmotion.com
> Webmotion Inc. Fax. (613) 260-9545 mikael.grave@webmotion.com
> `----------------------------------------------------------------'
use() is a new feature of PHP4 which works like include() but will
only include each file once. AFAIK you choices are: Hack PHP4 and
rename use() (thereby rendering your code totally non-portable);
Rename your function; Go back to PHP3. I would personally write off
the first and third options given that you're using PHP4 and probably
don't want to patch every version of it you ever use.
Renaming your function shouldn't be so hard; a quick script to find
and replace the existing code could be written using find and sed, or
hell, even PHP. :)
--
+----------------------------------------------------------------+
|Torben Wilson <torben@php.net> Netmill iTech|
|http://www.coastnet.com/~torben http://www.netmill.fi|
|Ph: 1 250 383-9735 torben@netmill.fi|
+----------------------------------------------------------------+