php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #70054 Mistype error
Submitted: 2015-07-12 15:53 UTC Modified: 2015-07-12 17:23 UTC
From: support at cattechsol dot com Assigned: cmb (profile)
Status: Not a bug Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
48 - 36 = ?
Subscribe to this entry?

 
 [2015-07-12 15:53 UTC] support at cattechsol dot com
Description:
------------
---
From manual page: http://www.php.net/filter.examples.validation
---
In PHP Filter Email Validation there is mistype error in the first example. 

<?php
$email_a = 'joe@example.com';
$email_b = 'bogus';

if (filter_var($email_a, FILTER_VALIDATE_EMAIL)) {
    echo "This ($email_a) email address is considered valid.";
}
if (filter_var($email_b, FILTER_VALIDATE_EMAIL)) {
    echo "This ($email_b) email address is considered valid.";
}
?>

Both the bogus and valid are given valid emails...


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-07-12 17:23 UTC] cmb@php.net
-Status: Open +Status: Not a bug -Assigned To: +Assigned To: cmb
 [2015-07-12 17:23 UTC] cmb@php.net
The example is correct. For the second address ("bogus")
filter_var() returns false, and so the echo statement is not
executed. The output can be seen below the example.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 10:01:29 2024 UTC