Re: Class Problems
| From: | Ashley Sheridan | Date: | Tue, 11 Aug 2009 15:46:39 +0000 |
| Subject: | Re: Class Problems | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-296641@lists.php.net to get a copy of this message | ||
On Tue, 2009-08-11 at 10:40 -0500, larry@garfieldtech.com wrote:
> The "private" keyword was added in PHP 5. PHP 4 doesn't have visibility
> identifiers. In PHP 4 you have to use "var", which is then always public.
>
> Or you could just use PHP 5 instead of a dead language. :-)
>
> Ashley Sheridan wrote:
> > Hey all,
> >
> > Is there any reason why this shouldn't work correctly on a server
> > running PHP 4.4.7:
> >
> > <?php
> > class testClass
> > {
> > private $foo = 'bar';
> > }
> >
> > print 'wtf';
> > ?>
> >
> > I would at the very least expect to see the 'wtf' printed out. I've got
> > a whole class I've written that works fine in PHP 5, but on PHP 4
> > server, it does nothing with even this simple example.
> >
> > Any ideas?
> >
> > Thanks,
> > Ash
> > http://www.ashleysheridan.co.uk
> >
> >
>
Ah, I was looking up in the documentation, but seem to have missed that.
Just changed the code, and it's working again! The public/private thing
will only really be an issue if someone other than me is using this
script, which is unlikely just at the moment, but ah well!
And I really would use a PHP 5 server given the choice. I've tried
speaking to the hosting company a few times, but they brush me off!
Thanks,
Ash
http://www.ashleysheridan.co.uk