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
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
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-
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
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
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
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
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
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($
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 __
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
11 matches
Mail list logo