//Returns an array with properties of an object function GetAnArrayOfPropertiesForAnObject($Object) { $arrayProperties = get_object_vars( $Object); foreach($arrayProperties as $key=>$value) { $returnArray[] = strtolower($key); } return $returnArray; }
How to write code in C#, Asp.Net, Php, Javascript, C. On this blog you will find example codes that will help you to understand concepts of programming.
Monday, February 27, 2012
How to get an array with properties of an object in Php?
If you ever need to get an array of properties for an object in php this is the method that I created and might help you with that. The key is to use get_object_vars() method, parse each key and memorize in an array.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment