note 108097 deleted from language.oop5.overloading by danbrown
| From: | danbrown@php.net | Date: | Thu, 10 May 2012 17:39:49 +0000 |
| Subject: | note 108097 deleted from language.oop5.overloading by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-187681@lists.php.net to get a copy of this message | ||
Note Submitter: smljackson402 at gmail dot com
----
Is the following class is valid.
class TestCase{
public $test;
public setMe($data)
{
foreach($data as $name => $value)
{
$this->{$name} = $value;
}
}
}
$data = array('test1'=>1,'test2'=>2);
$test_case = new TestCase();
$test_case->setMe($data);
echo $test_case->test1;
What i am trying to do is create dynamic class variables.