How to convert imperial units of length into metric?

前端 未结 5 1713
心在旅途
心在旅途 2021-01-14 07:16

Here I am faced with an issue that I believe(or at least hope) was solved 1 million times already. What I got as the input is a string that represents a length of an object

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-14 08:07

    The Zend Framework has a measurement component for just that purpose. I suggest you check it out - here.

    $unit = new Zend_Measure_Length($length,Zend_Measure_Length::YARD);
    $unit -> convertTo(Zend_Measure_Length::METER);
    

提交回复
热议问题