Back to index

php5  5.3.10
033_run.inc
Go to the documentation of this file.
00001 <?php
00002 if (function_exists('setlocale')) {
00003        setlocale(LC_ALL, 'C');
00004 }
00005 
00006 function test($data) {
00007   return strtoupper($data);
00008 }
00009 
00010 $data = array(
00011        "PHP",
00012        "1",
00013        "foo@bar.com",
00014        "http://a.b.c",
00015        "1.2.3.4",
00016        "123",
00017        "123abc<>()",
00018        "O'Henry",
00019        "하퍼"
00020 );
00021 
00022 
00023 foreach(filter_list() as $filter) {
00024        if($filter=="validate_regexp") {
00025               foreach($data as $k=>$d) $result[$k] = filter_var($d,filter_id($filter),array("options"=>array("regexp"=>'/^O.*/')));
00026        } else {
00027               foreach($data as $k=>$d) $result[$k] = filter_var($d,filter_id($filter),array("options"=>"test"));
00028        }
00029        printf("%-20s",$filter);
00030        printf("%-5s",$result[0]);
00031        printf("%-3s",$result[1]);
00032        printf("%-15s",$result[2]);
00033        printf("%-20s",$result[3]);
00034        printf("%-10s",$result[4]);
00035        printf("%-5s",$result[5]);
00036        printf("%-20s",$result[6]);
00037        printf("%-15s",$result[7]);
00038        printf("%-10s\n",$result[8]);
00039 }
00040 ?>