# Migrating from Previous Versions

The API of `Zend_Currency` has changed in the past to enhance usability. If you started using `Zend_Currency` with a version which is mentioned in this chapter follow the guidelines below to migrate your scripts to the new API.

## Migrating from 1.0.2 to 1.0.3 or Newer

Creating an object of `Zend_Currency` has become simpler. You no longer have to give a script or set it to `NULL`. The optional script parameter is now an option which can be set through the `setFormat()` method.

    $currency = new Zend_Currency($currency, $locale);

The `setFormat()` method takes now an array of options. These options are set permanently and override all previously set values. Also a new option 'precision' has been added. The following options have been refactored:

- position: Replacement for the old 'rules' parameter.

- script: Replacement for the old 'script' parameter.

- format: Replacement for the old 'locale' parameter which does not set new currencies but only the number format.

- display: Replacement for the old 'rules' parameter.

- precision: New parameter.

- name: Replacement for the ole 'rules' parameter. Sets the full currencies name.

- currency: New parameter.

- symbol: New parameter.

    $currency->setFormat(array $options);

The `toCurrency()` method no longer supports the optional 'script' and 'locale' parameters. Instead it takes an options array which can contain the same keys as for the `setFormat()` method.

    $currency->toCurrency($value, array $options);

The methods `getSymbol()`, `getShortName()`, `getName()`, `getRegionList()` and `getCurrencyList()` are no longer static and can be called from within the object. They return the set values of the object if no parameter has been set.