You are here: Re: Getting and Setting and best practise « PHP Programming Language « IT news, forums, messages
Re: Getting and Setting and best practise

Posted by Vince Morgan on 04/20/07 20:51

"Steve" <no.one@example.com> wrote in message
news:vq9Wh.1927$lq2.213@newsfe04.lga...
> what's most funny, vince, is that we are arguing complete theory here. php
> does NOT support __set/__get in the way the op thinks it does. i wish it
> did, then all of this talk may do some good...for me anyway.
>
> cheers.
>
>
Perhaps not, but I was building a class a few days ago that was basicaly
like below. The array needs to store about 30 vals so I decided to implement
it similar to below.

class C_Obj
{
private $Obj=array('h'=>10,'i'=>12);

private function getVal($name)
{
return $this->Obj[$name];
}
function &__set($name, $val)
{
$name = $val;
}
function __get($name)
{
return self::getVal($name);
}
}

And it does what I want, as I want it to. Not what some would recomend
perhaps, but I am the one who has to use and maintain it.
Admittedly, I might just get hit by a torpedo tomorrow and my replacement
may not like it much :)
Vince

 

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

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