18.5. Special functions

To make your work easier, there are a few additional functions, which will be described below.

Listing all known types

Listing all known units

18.5.1. Listing all known types

The function getAllTypes returns an array containing all types of measurement.

This could be used to let a user choose the type of measurement (length, weight, area) he wishes to input.

18.5.2. Listing all known units

The function getTypeList returns an array containing all units of measurement for a given type.

This could be used to let a user choose the unit of measurement (meters, kilometers, millimeters,...) for his input.

Пример 18.18. Listing all units for a given type

<?php
require_once 'Zend/Measure/Length.php';

$unit = new Zend_Measure_Length(0,Zend_Measure_Length::STANDARD);

$array = $unit->getTypeList();
print_r($array);
?>