xref: /PHP-8.0/ext/filter/tests/025.phpt (revision 782352c5)
1--TEST--
2filter_var() and FILTER_SANITIZE_STRING
3--SKIPIF--
4<?php if (!extension_loaded("filter")) die("skip"); ?>
5--FILE--
6<?php
7
8var_dump(filter_var("", FILTER_SANITIZE_STRING));
9var_dump(filter_var("<>", FILTER_SANITIZE_STRING));
10var_dump(filter_var("<>!@#$%^&*()'\"", FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES));
11var_dump(filter_var("<>!@#$%^&*()'\"", FILTER_SANITIZE_STRING, FILTER_FLAG_ENCODE_AMP));
12var_dump(filter_var("<>`1234567890", FILTER_SANITIZE_STRING));
13var_dump(filter_var("`123`", FILTER_SANITIZE_STRING));
14var_dump(filter_var(".", FILTER_SANITIZE_STRING));
15
16echo "Done\n";
17?>
18--EXPECT--
19string(0) ""
20string(0) ""
21string(12) "!@#$%^&*()'""
22string(24) "!@#$%^&#38;*()&#39;&#34;"
23string(11) "`1234567890"
24string(5) "`123`"
25string(1) "."
26Done
27