note 17024 modified in language.oop by zak

From: Date: Thu, 22 Nov 2001 16:10:47 +0000
Subject: note 17024 modified in language.oop by zak
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-21170@lists.php.net to get a copy of this message
Methods may not use names that are reserved words in PHP. Examples of reserved words include: print echo for while ... For a complete list see the PHP manual appendices. --was-- It seems that class methods are not really part of the class. The scope of a method definition is global not local to the class. I have tried the following: class CMyClass { function Print () { } } It doesn't work because the PHP parser thinks that the "Print" method is the "print" PHP global function. I have tried to force scope: class CMyClass { function CMyClass::Print () { } } But it doesn't work. The only solution I found is to use an other name for my method, even if it really prints something. http://www.php.net/manual/en/language.oop.php

« previous php.notes (#21170) next »