You are here: Re: [PHP] Re: Why is it possible to assign data to _not_declared_ vars in a class (PHP 5.0.3)? « PHP « IT news, forums, messages
Re: [PHP] Re: Why is it possible to assign data to _not_declared_ vars in a class (PHP 5.0.3)?

Posted by Hanez on 04/09/05 13:59

On Friday 08 April 2005 20:22, Matthew Weier O'Phinney wrote:
> * Johannes Findeisen <mailman@hanez.org>:
> > If i understand right, all variables should be declared in PHP5. So
> > why is it possible to add a membervariable called "c" to the object
> > without making a declaration? I got no error with this. I thought
> > E_STRICT should show me things like that. Could someone explain me
> > that?
>
> You don't understand correctly. Class properties/attributes do not need
> to be explicitly declared in PHP. This did *not* change in PHP5. What
> changed in PHP5 is visibility. By default, unless declared otherwise, a
> class attribute is publicly visible -- the same behaviour seen in PHP4.

Okay, allright. I missunderstood that. But wouldn't it be nice to see things
like this in the error log when E_STRICT is activated. I know some
programming languages and i ever have dreamed about some features like this
in PHP5 and the main thing i was dreaming about was strict declaration. Now
since PHP5 i have thought about programming PHP again because of features
which would help me debugging my code. And this is not implemented perfectly.

I have some days ago allready posted a PHP5 issue which i thought that it
should be catched from the internal error handling with E_STRICT on. You can
see it here:

http://www.spinics.net/lists/php/msg117368.html

Thanks,
have a nice day.


Johannes Findeisen

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация