dcsimg
July 19, 2018
Hot Topics:

Create a Unit Conversion Application with the Zend_Measure Component

  • February 11, 2010
  • By Jason Gilmore
  • Send Email »
  • More Articles »

The Zend Framework's Zend_Measure component can convert between an enormous number of measurement formats. This useful tool carries out not only typical unit conversions such as between miles and kilometers, but also between a wide variety of scientific formats such as torque, frequency, force, illumination, current, and density.

Of course, performing even relatively simple conversion calculations from memory can be fairly difficult, let alone calculating more esoteric conversions such as from square meters to acres. To automate this conversion process, PHP Guru Jason Gilmore used the Zend Framework and the Zend_Measure component to create a measurement-calculator capable of easily migrating data among the most commonly used formats. In his PHPBuilder tutorial, he shows you how to create your own.

To use the Zend_Measure component, you start by defining the originating unit type and value, and then calling the convertTo() method to convert the value to the desired destination unit type. Therefore, to convert a value from one standard to another, you statically call the respective class constants. Each Zend_Measure class (Zend_Measure_Length, Zend_Measure_Volume, Zend_Measure_Area, etc.) contains a well-organized list of class constants at the top of the file.


Read the full story at PHPBuilder:
Create a Unit Conversion Application with the Zend_Measure Component






Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 


Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

By submitting your information, you agree that developer.com may send you developer offers via email, phone and text message, as well as email offers about other products and services that developer believes may be of interest to you. developer will process your information in accordance with the Quinstreet Privacy Policy.

Sitemap

Thanks for your registration, follow us on our social networks to keep up-to-date