Thread: array to object
View Single Post
Old 03-24-2008, 12:04 PM   #9 (permalink)
Salathe
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

You can check if a property exists with the appropriately named property_exists (PHP Manual Page). Note: As opposed with isset(), property_exists() returns TRUE even if the property has the value NULL.

As a side note, your original post didn't make it clear but it might be useful, have you tried something like: $object = (object) $arrray; since you did originally ask how "to quickly transform an array into an object".
Salathe is offline  
Reply With Quote
The Following 2 Users Say Thank You to Salathe For This Useful Post:
Alan @ CIT (03-24-2008), Gibou (03-24-2008)