Can someone please explain simply what the __get() magic function does?
<?php
class test
{
public function __set($name,$value)
{
echo $name.':'.$value;
}
public function __get($value)
{
echo $this->name;
}
}
$a = new test;
$a-> z = 1;
echo $a->z; echo "<br>"; echo "hi";
?>
For example how would I get the value of z in the above example?
<?php
class test
{
public function __set($name,$value)
{
echo $name.':'.$value;
}
public function __get($value)
{
echo $this->name;
}
}
$a = new test;
$a-> z = 1;
echo $a->z; echo "<br>"; echo "hi";
?>
For example how would I get the value of z in the above example?