xref: /PHP-7.2/ext/filter/tests/038.phpt (revision 2c3db736)
1--TEST--
2Test scalar, array
3--SKIPIF--
4<?php if (!extension_loaded("filter")) die("skip"); ?>
5--FILE--
6<?php
7
8$var = 12;
9$res = filter_var($var, FILTER_VALIDATE_INT, array('flags'=>FILTER_FLAG_ALLOW_OCTAL));
10var_dump($res);
11
12$var = array(12);
13$res = filter_var($var, FILTER_VALIDATE_INT, array('flags'=>FILTER_FLAG_ALLOW_OCTAL));
14var_dump($res);
15
16$var = 12;
17$res = filter_var($var, FILTER_VALIDATE_INT, array('flags'=>FILTER_FLAG_ALLOW_OCTAL|FILTER_FORCE_ARRAY));
18var_dump($res);
19
20
21
22$var = 12;
23$res = filter_var($var, FILTER_VALIDATE_INT, array('flags'=>FILTER_FLAG_ALLOW_OCTAL|FILTER_REQUIRE_ARRAY));
24var_dump($res);
25
26$var = array(12);
27$res = filter_var($var, FILTER_VALIDATE_INT, array('flags'=>FILTER_FLAG_ALLOW_OCTAL|FILTER_REQUIRE_ARRAY));
28var_dump($res);
29
30$var = array(12);
31$res = filter_var($var, FILTER_VALIDATE_INT, array('flags'=>FILTER_FLAG_ALLOW_OCTAL|FILTER_FORCE_ARRAY|FILTER_REQUIRE_ARRAY));
32var_dump($res);
33
34$var = array(12);
35$res = filter_var($var, FILTER_VALIDATE_INT, array('flags'=>FILTER_FLAG_ALLOW_OCTAL|FILTER_FORCE_ARRAY));
36var_dump($res);
37
38?>
39--EXPECT--
40int(12)
41bool(false)
42array(1) {
43  [0]=>
44  int(12)
45}
46bool(false)
47array(1) {
48  [0]=>
49  int(12)
50}
51array(1) {
52  [0]=>
53  int(12)
54}
55array(1) {
56  [0]=>
57  int(12)
58}
59