xref: /PHP-5.4/ext/filter/tests/035.phpt (revision 2c3db736)
1--TEST--
2GET/POST/REQUEST Test with input_filter
3--SKIPIF--
4<?php if (!extension_loaded("filter")) die("skip"); ?>
5--POST--
6d=379
7--GET--
8ar[elm1]=1234&ar[elm2]=0660&a=0234
9--FILE--
10<?php
11$ret = filter_input(INPUT_GET, 'a', FILTER_VALIDATE_INT);
12var_dump($ret);
13
14$ret = filter_input(INPUT_GET, 'a', FILTER_VALIDATE_INT, array('flags'=>FILTER_FLAG_ALLOW_OCTAL));
15var_dump($ret);
16
17$ret = filter_input(INPUT_GET, 'ar', FILTER_VALIDATE_INT, array('flags'=>FILTER_REQUIRE_ARRAY));
18var_dump($ret);
19
20$ret = filter_input(INPUT_GET, 'ar', FILTER_VALIDATE_INT, array('flags'=>FILTER_FLAG_ALLOW_OCTAL|FILTER_REQUIRE_ARRAY));
21var_dump($ret);
22
23?>
24--EXPECT--
25bool(false)
26int(156)
27array(2) {
28  ["elm1"]=>
29  int(1234)
30  ["elm2"]=>
31  bool(false)
32}
33array(2) {
34  ["elm1"]=>
35  int(1234)
36  ["elm2"]=>
37  int(432)
38}
39