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