Re[4]: [PHP] function names
| From: | Olexandr Vynnychenko | Date: | Fri, 26 Oct 2001 12:31:52 +0000 |
| Subject: | Re[4]: [PHP] function names | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-72468@lists.php.net to get a copy of this message | ||
MM> Check your code again. Without the this-> I get the same error that you got.
With this->> I don't.
I don't know what php you're using... Or maybe you haven't understood
something. Try this code:
<?php
class A
{
function print() //line 4
{
echo "foo";
}
}
?>
And php will tell you "Parse error: parse error, expecting `T_STRING'
in Newprint.php on line 4" because (as I guess) print() is not a
function, it's a language construction. So php simply doesn't let you
have function named like language constructions like "and", "or",
"array", "+", "$" and so on. In this case it would be similar as if
you wrote:
<?php
function array() { /* ... */ }
// or
function and() { /* ... */ }
// or
function &$+() { /* ... */ }
?>
In all these cases php writes "Parse error: ..."
--
Best regards,
Olexandr mailto:supaboy@i.com.ua