1<?php 2if (function_exists('setlocale')) { 3 setlocale(LC_ALL, 'C'); 4} 5 6function test($data) { 7 return strtoupper($data); 8} 9 10$data = array( 11 "PHP", 12 "1", 13 "foo@bar.com", 14 "http://a.b.c", 15 "1.2.3.4", 16 "123", 17 "123abc<>()", 18 "O'Henry", 19 "하퍼" 20); 21 22 23foreach(filter_list() as $filter) { 24 if($filter=="validate_regexp") { 25 foreach($data as $k=>$d) $result[$k] = filter_var($d,filter_id($filter),array("options"=>array("regexp"=>'/^O.*/'))); 26 } else { 27 foreach($data as $k=>$d) $result[$k] = filter_var($d,filter_id($filter),array("options"=>"test")); 28 } 29 printf("%-20s",$filter); 30 printf("%-5s",$result[0]); 31 printf("%-3s",$result[1]); 32 printf("%-15s",$result[2]); 33 printf("%-20s",$result[3]); 34 printf("%-10s",$result[4]); 35 printf("%-5s",$result[5]); 36 printf("%-20s",$result[6]); 37 printf("%-15s",$result[7]); 38 printf("%-10s\n",$result[8]); 39} 40?> 41