note 113435 added to function.get-object-vars

From: Date: Wed, 09 Oct 2013 21:37:46 +0000
Subject: note 113435 added to function.get-object-vars
Groups: php.notes 
Request: Send a blank email to php-notes+get-196517@lists.php.net to get a copy of this message
You can use call_user_func() to return public variables from inside the class: class Test { protected $protected; public $public; private $private; public function getPublicVars () { return call_user_func('get_object_vars', $this); } } $test = new Test(); var_dump($test->getPublicVars()); // array("public" => NULL) ---- Server IP: 80.64.47.13 Probable Submitter: 91.117.54.63 ---- Manual Page -- http://php.net/manual/en/function.get-object-vars.php Edit -- https://master.php.net/note/edit/113435 Del: integrated -- https://master.php.net/note/delete/113435/integrated Del: useless -- https://master.php.net/note/delete/113435/useless Del: bad code -- https://master.php.net/note/delete/113435/bad+code Del: spam -- https://master.php.net/note/delete/113435/spam Del: non-english -- https://master.php.net/note/delete/113435/non-english Del: in docs -- https://master.php.net/note/delete/113435/in+docs Del: other reasons-- https://master.php.net/note/delete/113435 Reject -- https://master.php.net/note/reject/113435 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#196517) next »