steve wrote:
OK, will try. Does this work in the CVS version?

<?php
error_reporting(E_ALL);
class A
{
        public $_t = 'something';
        public function __get($name)
        {
                $getter='get'.$name;
                if(method_exists($this,$getter))
                {
                        // getting a property
                        return $this->$getter();
                }
        }

        public function getTest()
        {
                return 'OK';
        }
}
$result='';
$one = new A();
var_dump($one);
echo "<BR>Test \$one->getTest(): ";
echo $one->getTest();
echo "<BR>Test \$one->Test: ";
echo $one->Test;
echo "<BR>Test with eval: ";
eval ('$result = $one->Test; ');
echo $result;
echo "<BR>Testing done.";

It outputs:
object(A)#1 (1) { ["_t"]=>  string(9) "something" }
Test $one->getTest(): OK
Test $one->Test: OK
Test with eval: OK
Testing done.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to