note 16614 added to language.oop
| From: | alex-spam at rdc dot ru | Date: | Tue, 06 Nov 2001 18:24:50 +0000 |
| Subject: | note 16614 added to language.oop | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-20517@lists.php.net to get a copy of this message | ||
It seems impossible to define a member function with a name of
ANY function already existing in PHP namespace. For me that's weird.
This DOES NOT work in PHP 4.0.6:
---
class Useless {
function print ($s) {
echo $s;
}
}
$junk = new Useless;
$junk->print ("hello");
---
, giving out
Parse error: parse error, expecting `T_STRING' in script.php on line 4
Renaming member function 'print' into something unique like
'myPrint' makesthe thing work, but that's against the whole OOP encapsulation
principle!
To the editors - please comment. I'm totally exhausted
trying to find the explanation in manuals - name conflict
issue is not covered. If there's a configuration option that
will 'unlock' this limitation, it MUST be clearly described
on this chapter. If the limitation is fatal, it must be
stated under 'This code will not work:'
--
http://www.php.net/manual/en/language.oop.php
http://master.php.net/manage/user-notes.php?action=edit+16614
http://master.php.net/manage/user-notes.php?action=delete+16614
http://master.php.net/manage/user-notes.php?action=reject+16614