note 107320 added to function.get-class-vars

From: Date: Mon, 30 Jan 2012 22:06:33 +0000
Subject: note 107320 added to function.get-class-vars
Groups: php.notes 
Request: Send a blank email to php-notes+get-185799@lists.php.net to get a copy of this message
I propse following for getting Public members, always: <?PHP if (!function_exists("get_public_class_vars")) { function get_public_class_vars($class) { return get_class_vars($class); } } if (!function_exists("get_public_object_vars")) { function get_public_object_vars($object) { return get_object_vars($object); } } ?> This is to mitigate the problem and a feature that get_object_vars($this) returns private members. Running it simply outside the scope will get the public. Iterating public members only and their defaults are enormously useful in e.g. in serialization classes such as options where each public member is an serializable that is saved and loaded. ---- Server IP: 69.147.83.197 Probable Submitter: 77.86.203.175 ---- Manual Page -- http://www.php.net/manual/en/function.get-class-vars.php Edit -- https://master.php.net/note/edit/107320 Del: integrated -- https://master.php.net/note/delete/107320/integrated Del: useless -- https://master.php.net/note/delete/107320/useless Del: bad code -- https://master.php.net/note/delete/107320/bad+code Del: spam -- https://master.php.net/note/delete/107320/spam Del: non-english -- https://master.php.net/note/delete/107320/non-english Del: in docs -- https://master.php.net/note/delete/107320/in+docs Del: other reasons-- https://master.php.net/note/delete/107320 Reject -- https://master.php.net/note/reject/107320 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#185799) next »