note 68176 added to language.oop5.interfaces
| From: | GrigoriKochanov at osu1 dot php dot net | Date: | Mon, 17 Jul 2006 09:24:28 +0000 |
| Subject: | note 68176 added to language.oop5.interfaces | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-114838@lists.php.net to get a copy of this message | ||
The engine does not recognise the class that implements an interface as declared in the code written
before the class declaration is placed.
This means that you can't place the declaration of a classes that implements an interfaces in
the code beneath the creation of an instance.
Tony2001 said this is an expected behaviour of Zend engine.
Back to PHP 3 ;-)
<?php
var_dump(class_exists('validatorCheck'));
//you don't write $obj = new validatorCheck() here
class validatorCheck implements ArrayAccess {
function offsetGet($key){}
function offsetSet($key, $value) {}
function offsetUnset($key) {}
function offsetExists($offset) {}
//class end
}
var_dump(class_exists('validatorCheck'));
//an instance can be created only here
?>
Result:
bool(false)
bool(true)
----
Server IP: 66.163.161.117
Probable Submitter: 82.207.103.174 (proxied: 10.1.1.2)
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/language.oop5.interfaces.php
Edit -- http://master.php.net/note/edit/68176
Del: integrated -- http://master.php.net/note/delete/68176/integrated
Del: useless -- http://master.php.net/note/delete/68176/useless
Del: bad code -- http://master.php.net/note/delete/68176/bad+code
Del: spam -- http://master.php.net/note/delete/68176/spam
Del: non-english -- http://master.php.net/note/delete/68176/non-english
Del: in docs -- http://master.php.net/note/delete/68176/in+docs
Del: other reasons-- http://master.php.net/note/delete/68176
Reject -- http://master.php.net/note/reject/68176
Search -- http://master.php.net/manage/user-notes.php