$obj = new Varien_Object(); $obj->setData('name', 'John'); echo $obj->getData('name'); // Output: John
$data = array( 'name' => 'John', 'age' => 30, 'email' => 'john@example.com' ); $obj = new Varien_Object($data); echo $obj->getData('name'); // Output: John echo $obj->getData('age'); // Output: 30 echo $obj->getData('email'); // Output: john@example.com
$obj = new Varien_Object(); $obj->setData('name', 'John'); if ($obj->hasData('name')) { echo 'Name exists'; }In Magento, Varien_Object is used extensively for storing and retrieving data across the platform core and modules.