|
|
@@ -72,27 +72,6 @@ $unit = new Zend_Measure_Number($mystring, Zend_Measure_Number::BINARY);
|
|
|
echo $unit;
|
|
|
]]></programlisting>
|
|
|
</example>
|
|
|
-
|
|
|
- <para>
|
|
|
- Usually, <classname>Zend_Measure_*</classname> can automatically extract the desired measurement embedded in an
|
|
|
- arbitrary string. Only the first identifiable number denoted using standard European/Latin digits
|
|
|
- (0,1,2,3,4,5,6,7,8,9) will be used for measurement creation. If there are more numerals later in the string,
|
|
|
- the rest of these numerals will be ignored.
|
|
|
- </para>
|
|
|
-
|
|
|
- <example id="zend.measure.creation.string.example-2">
|
|
|
- <title>Arbitrary text input containing measurements</title>
|
|
|
- <programlisting language="php"><![CDATA[
|
|
|
-$mystring = "My house is 125m² in size";
|
|
|
-$unit = new Zend_Measure_Area($mystring, Zend_Measure_Area::STANDARD);
|
|
|
-echo $unit; // outputs "125 m²in size";
|
|
|
-
|
|
|
-$mystring = "My house is 125m² in size, it has 5 rooms of 25m² each.";
|
|
|
-$unit = new Zend_Measure_Area($mystring, Zend_Measure_Area::STANDARD);
|
|
|
-echo $unit; // outputs "125 m² in size";
|
|
|
-]]></programlisting>
|
|
|
- </example>
|
|
|
-
|
|
|
</sect2>
|
|
|
|
|
|
<sect2 id="zend.measure.creation.localized">
|
|
|
@@ -112,13 +91,13 @@ echo $unit; // outputs "125 m² in size";
|
|
|
<title>Localized string</title>
|
|
|
<programlisting language="php"><![CDATA[
|
|
|
$locale = new Zend_Locale('de');
|
|
|
-$mystring = "The boat is 1,234.50 long.";
|
|
|
+$mystring = "1,234.50";
|
|
|
$unit = new Zend_Measure_Length($mystring,
|
|
|
Zend_Measure_Length::STANDARD,
|
|
|
$locale);
|
|
|
echo $unit; // outputs "1.234 m"
|
|
|
|
|
|
-$mystring = "The boat is 1,234.50 long.";
|
|
|
+$mystring = "1,234.50";
|
|
|
$unit = new Zend_Measure_Length($mystring,
|
|
|
Zend_Measure_Length::STANDARD,
|
|
|
'en_US');
|