1--TEST-- 2filter_var() 3--INI-- 4precision=14 5--SKIPIF-- 6<?php if (!extension_loaded("filter")) die("skip"); ?> 7--FILE-- 8<?php 9 10var_dump(filter_var(array(1,"1","", "-23234", "text", "asdf234asdfgs", array()), FILTER_VALIDATE_INT, FILTER_REQUIRE_ARRAY)); 11var_dump(filter_var(array(1.2,"1.7","", "-23234.123", "text", "asdf234.2asdfgs", array()), FILTER_VALIDATE_FLOAT, FILTER_REQUIRE_ARRAY)); 12var_dump(filter_var(1, array())); 13var_dump(filter_var(1, FILTER_SANITIZE_STRING, 1)); 14var_dump(filter_var(1, FILTER_SANITIZE_STRING, 0)); 15var_dump(filter_var(1, FILTER_SANITIZE_STRING, array())); 16var_dump(filter_var(1, -1, array(123))); 17var_dump(filter_var(1, 0, array())); 18 19echo "Done\n"; 20?> 21--EXPECTF-- 22array(7) { 23 [0]=> 24 int(1) 25 [1]=> 26 int(1) 27 [2]=> 28 bool(false) 29 [3]=> 30 int(-23234) 31 [4]=> 32 bool(false) 33 [5]=> 34 bool(false) 35 [6]=> 36 array(0) { 37 } 38} 39array(7) { 40 [0]=> 41 float(1.2) 42 [1]=> 43 float(1.7) 44 [2]=> 45 bool(false) 46 [3]=> 47 float(-23234.123) 48 [4]=> 49 bool(false) 50 [5]=> 51 bool(false) 52 [6]=> 53 array(0) { 54 } 55} 56 57Warning: filter_var() expects parameter 2 to be long, array given in %s on line %d 58NULL 59string(1) "1" 60string(1) "1" 61string(1) "1" 62bool(false) 63bool(false) 64Done 65