Convert Array to Object in PHP
function array2obj($data) {
return is_array($data) ? (object) array_map( __FUNCTION__ ,$data) : $data;
}
Source: http://www.serversidemagazine.com/php/how-to-convert-array-notation-to-object-notation
function array2obj($data) {
return is_array($data) ? (object) array_map( __FUNCTION__ ,$data) : $data;
}
Source: http://www.serversidemagazine.com/php/how-to-convert-array-notation-to-object-notation
Comments