'John', 'age' => 30, 'address' => '123 Main St' ]); $arrayData = $data->toArray(); print_r($arrayData); ?>
setName('John'); $data->setAge(30); $data->setAddress('123 Main St'); $arrayData = $data->toArray(); print_r($arrayData); ?>In this example, we create an empty Varien_Object and use its setter methods to add three key-value pairs. We then use the toArray method to convert the object into an associative array, which is stored in $arrayData. Finally, we use print_r to display the contents of the array. Varien_Object is a part of the Magento core library.