note 108097 added to language.oop5.overloading

From: Date: Wed, 28 Mar 2012 09:15:09 +0000
Subject: note 108097 added to language.oop5.overloading
Groups: php.notes 
Request: Send a blank email to php-notes+get-186888@lists.php.net to get a copy of this message
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. ---- Server IP: 69.147.83.197 Probable Submitter: 122.172.206.69 ---- Manual Page -- http://www.php.net/manual/en/language.oop5.overloading.php Edit -- https://master.php.net/note/edit/108097 Del: integrated -- https://master.php.net/note/delete/108097/integrated Del: useless -- https://master.php.net/note/delete/108097/useless Del: bad code -- https://master.php.net/note/delete/108097/bad+code Del: spam -- https://master.php.net/note/delete/108097/spam Del: non-english -- https://master.php.net/note/delete/108097/non-english Del: in docs -- https://master.php.net/note/delete/108097/in+docs Del: other reasons-- https://master.php.net/note/delete/108097 Reject -- https://master.php.net/note/reject/108097 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#186888) next »