1--TEST-- 2filter_var() and doubles with thousend separators 3--EXTENSIONS-- 4filter 5--FILE-- 6<?php 7$test = array( 8 '0' => 0.0, 9 '12345678900.1234567165' => 12345678900.1234567165, 10 '1,234,567,890.1234567165' => 1234567890.1234567165, 11 '-1,234,567,890.1234567165' => -1234567890.1234567165, 12 '1234,567,890.1234567165' => false, 13 '1,234,567,89.1234567165' => false, 14 '1,234,567,8900.1234567165' => false, 15 '1.234.567.890.1234567165' => false, 16 '1,234,567,8900.123,456' => false, 17); 18foreach ($test as $src => $dst) { 19 $out = filter_var($src, FILTER_VALIDATE_FLOAT, array("flags"=>FILTER_FLAG_ALLOW_THOUSAND)); 20 if ($dst !== $out) { 21 if ($out === false) { 22 echo "$src -> false != $dst\n"; 23 } elseif ($dst === false) { 24 echo "$src -> $out != false\n"; 25 } else { 26 echo "$src -> $out != $dst\n"; 27 } 28 } 29} 30 31echo "Ok\n"; 32?> 33--EXPECT-- 34Ok 35