I’m trying to check if number is float with Zend. If I invoke this code:
Zend_Locale_Format::isFloat('4.202', array('locale' => 'de'));
it returns true. However, this:
Zend_Locale_Format::isFloat('4.20', array('locale' => 'de'));
returns false. Why?
This is because German locale uses the period
.as the thousand separator, and in your second example that separator is in the wrong place.For example:
Should give the expected
truewhen passed toisFloat().Btw,
4.202gets interpreted as4202(which could also be considered a float without a fraction).See also: Normalization and Localization, section “29.3.6. Floating point value testing”