Re: Constants
| From: | Jakes | Date: | Tue, 23 Mar 2004 14:32:23 +0000 |
| Subject: | Re: Constants | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-181260@lists.php.net to get a copy of this message | ||
You can keep constant variables in an interface, because thay are
static and do not change. Trust me, it is a bug.
"Gerben" <gerbendekeijzer@12move.nl> wrote in message
news:20040323134957.6064.qmail@pb1.pair.com...
> this is probably because Foo is an interface instead of a class.
interfaces
> can't contain any data as far as I know.
>
> "Jakes" <sunsoffun@hotmail.com> wrote in message
> news:20040323074827.96225.qmail@pb1.pair.com...
> > The bug server looks like its down, so I will just post the bug here,
and
> > hopefully someone
> > will spot it
> >
> > PHP version: 5RC1
> >
> > <?php
> > interface Foo {
> > const MY_FOO = "hello world";
> > }
> > class Bar implements Foo {
> > public function displayFoo(){
> > print MY_FOO;
> > }
> > }
> > $obj = new Bar;
> > $obj->displayFoo();
> > ?>
> >
> > The results should display "hello world", but it prints out MY_FOO.
> >
> > Thanks
> >
> > Jakes