PHP prevents interface a contant to be overridden by a class/interface that DIRECTLY inherits it. However, further inheritance allows it. That means that interface constants are not final as mentioned in a previous comment. Is this a bug or a feature?
<?php
interface a
{
const b = 'Interface constant';
}
// Prints: Interface constant
echo a::b;
class b implements a
{
}
// This works!!!
class c extends b
{
const b = 'Class constant';
}
echo c::b;
?>
----
Server IP: 69.147.83.197
Probable Submitter: 70.239.149.143
----
Manual Page -- http://www.php.net/manual/en/language.oop5.interfaces.php
Edit -- https://master.php.net/note/edit/102755
Del: integrated -- https://master.php.net/note/delete/102755/integrated
Del: useless -- https://master.php.net/note/delete/102755/useless
Del: bad code -- https://master.php.net/note/delete/102755/bad+code
Del: spam -- https://master.php.net/note/delete/102755/spam
Del: non-english -- https://master.php.net/note/delete/102755/non-english
Del: in docs -- https://master.php.net/note/delete/102755/in+docs
Del: other reasons-- https://master.php.net/note/delete/102755
Reject -- https://master.php.net/note/reject/102755
Search -- https://master.php.net/manage/user-notes.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.