$obj = new Varien_Object(); // creating a new object $obj->setData('name', 'John'); // setting data if($obj->hasData('name')) { // checking if data exists echo "The object has data."; } else { echo "The object does not have data."; }In this example, we create a new Varien_Object and set a data value using the setData() method. We then use the hasData() method to check if the object has any data. If the object has data, it will echo "The object has data.", otherwise it will echo "The object does not have data." Package library: This code example is part of the Magento library since Varien_Object is a core class in Magento.