xref: /PHP-5.6/ext/filter/tests/017.phpt (revision 2c3db736)
1--TEST--
2filter_var() and FILTER_VALIDATE_REGEXP
3--SKIPIF--
4<?php if (!extension_loaded("filter")) die("skip"); ?>
5--FILE--
6<?php
7
8var_dump(filter_var("data", FILTER_VALIDATE_REGEXP, array("options"=>array("regexp"=>'/.*/'))));
9var_dump(filter_var("data", FILTER_VALIDATE_REGEXP, array("options"=>array("regexp"=>'/^b(.*)/'))));
10var_dump(filter_var("data", FILTER_VALIDATE_REGEXP, array("options"=>array("regexp"=>'/^d(.*)/'))));
11var_dump(filter_var("data", FILTER_VALIDATE_REGEXP, array("options"=>array("regexp"=>'/blah/'))));
12var_dump(filter_var("data", FILTER_VALIDATE_REGEXP, array("options"=>array("regexp"=>'/\[/'))));
13var_dump(filter_var("data", FILTER_VALIDATE_REGEXP));
14
15echo "Done\n";
16?>
17--EXPECTF--
18string(4) "data"
19bool(false)
20string(4) "data"
21bool(false)
22bool(false)
23
24Warning: filter_var(): 'regexp' option missing in %s on line %d
25bool(false)
26Done
27