Re: APC and PHP 5.1.2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux