xref: /PHP-5.3/ext/filter/tests/016.phpt (revision 97442841)
1--TEST--
2filter_var() and FILTER_VALIDATE_EMAIL
3--SKIPIF--
4<?php if (!extension_loaded("filter")) die("skip"); ?>
5--FILE--
6<?php
7$values = Array(
8'a@b.c',
9'abuse@example.com',
10'test!.!@#$%^&*@example.com',
11'test@@#$%^&*())).com',
12'test@.com',
13'test@com',
14'@',
15'[]()/@example.com',
16'QWERTYUIOPASDFGHJKLZXCVBNM@QWERTYUIOPASDFGHJKLZXCVBNM.NET',
17'e.x.a.m.p.l.e.@example.com',
18'firstname.lastname@employee.2something.com',
19'-@foo.com',
20'foo@-.com',
21'foo@bar.123',
22'foo@bar.-'
23);
24foreach ($values as $value) {
25	var_dump(filter_var($value, FILTER_VALIDATE_EMAIL));
26}
27
28echo "Done\n";
29?>
30--EXPECT--
31string(5) "a@b.c"
32string(17) "abuse@example.com"
33bool(false)
34bool(false)
35bool(false)
36bool(false)
37bool(false)
38bool(false)
39string(57) "QWERTYUIOPASDFGHJKLZXCVBNM@QWERTYUIOPASDFGHJKLZXCVBNM.NET"
40bool(false)
41string(42) "firstname.lastname@employee.2something.com"
42string(9) "-@foo.com"
43bool(false)
44bool(false)
45bool(false)
46Done
47