## 26.1. Introduction

`Zend_Measure_*` classes provide a generic and easy way for working with measurements. Using `Zend_Measure_*` classes, you can convert measurements into different units of the same type. They can be added, subtracted and compared against each other. From a given input made in the user's native language, the unit of measurement can be automatically extracted. Numerous units of measurement are supported.

–Я—А–Є–Љ–µ—А 26.1. Converting measurements

The following introductory example shows automatic conversion of units of measurement. To convert a measurement, its value and its type have to be known. The value can be an integer, a float, or even a string containing a number. Conversions are only possible for units of the same type (mass, area, temperature, velocity, etc.), not between types.

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

\$locale = new Zend_Locale('en');
\$unit = new Zend_Measure_Length(100, Zend_Measure_Length::METER, \$locale);

// Convert meters to yards
echo \$unit->convertTo(Zend_Measure_Length::YARD);
```

`Zend_Measure_*` includes support for many different units of measurement. The units of measurement all have a unified notation: `Zend_Measure_<TYPE>::NAME_OF_UNIT`, where <TYPE> corresponds to a well-known physical or numerical property. . Every unit of measurement consists of a conversion factor and a display unit. A detailed list can be found in the chapter `Types of measurements` .

–Я—А–Є–Љ–µ—А 26.2. The `meter` measurement

The `meter` is used for measuring lengths, so its type constant can be found in the `Length` class. To refer to this unit of measurement, the notation `Length::METER` must be used. The display unit is `m`.

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

echo Zend_Measure_Length::STANDARD;  // outputs 'Length::METER'
echo Zend_Measure_Length::KILOMETER; // outputs 'Length::KILOMETER'

\$unit = new Zend_Measure_Length(100,'METER');
echo \$unit;
// outputs '100 m'
```

–Я–Њ–і–і–µ—А–ґ–∞—В—М —Б–∞–є—В –љ–∞ —А–Њ–і–Є—В–µ–ї—М—Б–Ї–Њ–Љ –њ—А–Њ–µ–Ї—В–µ –Ъ–У–С
{"ft_lang_label":"__label__en","ft_lang_prob":0.8084363,"math_prob":0.9345467,"size":2073,"snap":"2019-13-2019-22","text_gpt3_token_len":547,"char_repetition_ratio":0.19188014,"word_repetition_ratio":0.0071174377,"special_character_ratio":0.2436083,"punctuation_ratio":0.20050761,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9848779,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-05-22T20:42:07Z\",\"WARC-Record-ID\":\"<urn:uuid:a195f801-ef33-4fa8-ae03-fe828cb34490>\",\"Content-Length\":\"17188\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:9b67993d-aa46-4c00-9315-77d700566bf7>\",\"WARC-Concurrent-To\":\"<urn:uuid:df8085a4-129d-4688-81db-7cbcf3b9ef9f>\",\"WARC-IP-Address\":\"195.128.17.149\",\"WARC-Target-URI\":\"https://php5.kiev.ua/zend/zend.measure.html\",\"WARC-Payload-Digest\":\"sha1:3L7SVUX2PPF5ZGDCKEO6VZXHW3EIMEZ4\",\"WARC-Block-Digest\":\"sha1:6SONOO2533LORCKHTYBSMLXCXRXRBQFT\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-22/CC-MAIN-2019-22_segments_1558232256958.53_warc_CC-MAIN-20190522203319-20190522225319-00527.warc.gz\"}"}