Check property exists - converting json to stdObject and then inserting value or null into db Check property exists - converting json to stdObject and then inserting value or null into db json json

Check property exists - converting json to stdObject and then inserting value or null into db


As i see it, you're trying to check if a key exists in your object, You could use PHP's property_exists function for that.

function _nullify($object, $key){    if(property_exists($object, $key))        return empty($object->$key) ? NULL : $object->$key;    else        return NULL;}

Shai.