php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #72448 Missing $ in echo text
Submitted: 2016-06-18 23:06 UTC Modified: 2016-06-19 15:14 UTC
From: eric at schorvitz 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 + 6 = ?
Subscribe to this entry?

 
 [2016-06-18 23:06 UTC] eric at schorvitz dot com
Description:
------------
---
From manual page: http://www.php.net/filter.examples.validation
---

<?php
$ip_a = '127.0.0.1';
$ip_b = '42.42';

if (filter_var($ip_a, FILTER_VALIDATE_IP)) {
    echo "This (ip_a) IP address is considered valid.";
}
if (filter_var($ip_b, FILTER_VALIDATE_IP)) {
    echo "This (ip_b) IP address is considered valid.";
}
?>

This (ip_a) should be: This ($ip_a)
This (ip_b) should be: This ($ip_b)


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-06-19 15:14 UTC] cmb@php.net
-Status: Open +Status: Not a bug -Assigned To: +Assigned To: cmb
 [2016-06-19 15:14 UTC] cmb@php.net
Have a look at the expected output:

| This (ip_a) IP address is considered valid.

That wouldn't match for $ip_a. Of course, the output could be
changed, but what would that be good for? The example already
shows, that the first IP address is considered valid, while the
second is not.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Thu Dec 03 20:01:23 2020 UTC