Reply to Re: Capitalization and Classes

Your name:

Reply:


Posted by Good Man on 11/06/07 20:11

Darko <darko.maksimovic@gmail.com> wrote in
news:1194378798.505407.6390@k79g2000hse.googlegroups.com:


>> print $p->name;
>> print $p->Name;
>>
>> The method in the class is getName, so why would "name" (lowercase)
>> work here? All my experience in PHP says that uppercase/lowercase is
>> vitally important!
>>
>> Here's the class:
>>
>> class Person {
>>
>> function __get($property) {
>> $method = "get{$property}";
>> if(method_exists($this,$method)) {
>> return $this->$method();
>> }
>> }
>>
>> function getName() {
>> return "Bob";
>> }
>>
>> function getAge() {
>> return 44;
>> }
>>
>> }
>
> It's impossible that works. You probably meant $p->getname() and $p-
>>getName()


Promise you that it does :)

It's all about the __get($property) Interceptor Method :)

[Back to original 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

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