well.
On Sun, Oct 18, 2009 at 1:24 PM, Tommy Pham wrote:
> - Original Message
> > From: mbneto
> > To: php-general@lists.php.net
> > Sent: Sun, October 18, 2009 8:31:53 AM
> > Subject: [PHP] Using setters/getters with array of objects
> >
> > Hi
Hi,
Thanks. I'll probably do the addEmail method. I was hoping to do as with
the other "non-array" properties.
On Sun, Oct 18, 2009 at 1:00 PM, Andy Shellam (Mailing Lists)
wrote:
> Hi,
>
>
> $u->emails[] = $e;
>
>
> I would hazard a guess because $u->emails isn't a concrete object (whereas
- Original Message
> From: mbneto
> To: php-general@lists.php.net
> Sent: Sun, October 18, 2009 8:31:53 AM
> Subject: [PHP] Using setters/getters with array of objects
>
> Hi,
>
> I have two classes User and Email where one User can have many Emails so
> I
Hi,
$u->emails[] = $e;
I would hazard a guess because $u->emails isn't a concrete object
(whereas $u->_emails is, but is private.) It's sort of a virtual
reference - PHP has no way of knowing that $u->emails actually
translates into _emails which is an array, if you see what I mean
(
Hi,
I have two classes User and Email where one User can have many Emails so
I've done like this
class Email
{
protected $_email;
public function __get($name)
{
$property = '_' . $name;
return $this->$property;
}
public function __set($name, $value)
{
5 matches
Mail list logo