Re: [PHP] Overloading Limitation- Can Someone Confirm?

2006-03-31 Thread Jochem Maas
Chr is wrote: You're right, it's not going through the __Set() method a second time. If you REALLY want to get confused by overloading behavior try the following code using your T class: $t = new T; $t->insideArray = array('a' => 'A', 'b' => 'B', 'c' => 'C'); foreach ($t->insideArray a

Re: [PHP] Overloading Limitation- Can Someone Confirm?

2006-03-31 Thread Jochem Maas
could you both take a look at this (I posted it already btw) - notice that the second 'set' action ($t->insideArray["test"] = "testing!";) is not going via __set() at all, it uses __get() BUT/AND then an item is set in the returned array ... and also in the [sub] array stored inside the object (ev

Re: [PHP] Overloading Limitation- Can Someone Confirm?

2006-03-31 Thread Jasper Bryant-Greene
Jim Lucas wrote: Jasper Bryant-Greene wrote: Jochem Maas wrote: [snip] you guess wrong :-) .. I couldn't resist testing it: php -r ' class T { private $var = array(); function __set($k, $v) { $this->var[$k] = $v; } function __get($k) { var_dump($k); } } $t = new T; $t->arr = array(); $t-

Re: [PHP] Overloading Limitation- Can Someone Confirm?

2006-03-31 Thread Jim Lucas
Jasper Bryant-Greene wrote: Jochem Maas wrote: Jasper Bryant-Greene wrote: Jochem Maas wrote: I think its a misunderstanding on the one side and a limitation on the other, you can't use overloading directly on items of an overloaded array e.g: echo $tc->arr['a'] this is triggers a cal

Re: [PHP] Overloading Limitation- Can Someone Confirm?

2006-03-31 Thread Jochem Maas
Jasper Bryant-Greene wrote: Jochem Maas wrote: Jasper Bryant-Greene wrote: Jochem Maas wrote: I think its a misunderstanding on the one side and a limitation on the other, you can't use overloading directly on items of an overloaded array e.g: echo $tc->arr['a'] this is triggers a ca

Re: [PHP] Overloading Limitation- Can Someone Confirm?

2006-03-30 Thread Jasper Bryant-Greene
Jochem Maas wrote: Jasper Bryant-Greene wrote: Jochem Maas wrote: I think its a misunderstanding on the one side and a limitation on the other, you can't use overloading directly on items of an overloaded array e.g: echo $tc->arr['a'] this is triggers a call to __get() with the $key par

Re: [PHP] Overloading Limitation- Can Someone Confirm?

2006-03-30 Thread Jochem Maas
Jasper Bryant-Greene wrote: Jochem Maas wrote: I think its a misunderstanding on the one side and a limitation on the other, you can't use overloading directly on items of an overloaded array e.g: echo $tc->arr['a'] this is triggers a call to __get() with the $key parameter set to somet

Re: [PHP] Overloading Limitation- Can Someone Confirm?

2006-03-30 Thread Jasper Bryant-Greene
Jochem Maas wrote: I think its a misunderstanding on the one side and a limitation on the other, you can't use overloading directly on items of an overloaded array e.g: echo $tc->arr['a'] this is triggers a call to __get() with the $key parameter set to something like (I'm guessing) "arr

Re: [PHP] Overloading Limitation- Can Someone Confirm?

2006-03-30 Thread Jochem Maas
Chris wrote: While playing with an unnamed framework, I think I discovered an overloading limitation (PHP 5.1.2). Can someone please confirm this limitation? Example class: class testClass { public $vars = array(); public function __get($key) { return array_key_exists($

Re: [PHP] Overloading Limitation- Can Someone Confirm?

2006-03-30 Thread Jasper Bryant-Greene
Chris wrote: class testClass { public $vars = array(); public function __get($key) { return array_key_exists($key, $this->vars) ? $this->vars[$key] : null; } public function __set($key, $value) { $this->vars[$key] = $value; } public function __

[PHP] Overloading Limitation- Can Someone Confirm?

2006-03-30 Thread Chris
While playing with an unnamed framework, I think I discovered an overloading limitation (PHP 5.1.2). Can someone please confirm this limitation? Example class: class testClass { public $vars = array(); public function __get($key) { return array_key_exists($key, $this->va