php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #9120 unexpected behavior of chop(), ltrim(), rtrim(), and trim()
Submitted: 2001-02-05 16:51 UTC Modified: 2001-03-20 05:54 UTC
From: artymiak at safenet dot pl Assigned:
Status: Closed Package: Strings related
PHP Version: 4.0.3pl1 OS: OpenBSD 2.7
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: artymiak at safenet dot pl
New email:
PHP Version: OS:

 

 [2001-02-05 16:51 UTC] artymiak at safenet dot pl
chop(), trim(), ltrim(), and rtrim() do not remove \v, \r, or \n.

# chop();

echo "<p><pre>                chop()";
echo "<br>                ------------------<br>";
$x = "     ab cd ef     \v\r\n" ;
echo strlen($x) . " characters: |" . $x . "|<br>";
$y = chop($x);
echo strlen($y) . " characters: |" . $y . "|</pre></p>";

# ltrim();

echo "<p><pre>                ltrim()";
echo "<br>                ------------------<br>";
$x = "\v\r\n     ab cd ef     " ;
echo strlen($x) . " characters: |" . $x . "|<br>";
$y = ltrim($x);
echo strlen($y) . " characters: |" . $y . "|</pre></p>";

# rtrim();

echo "<p><pre>                rtrim()";
echo "<br>                ------------------<br>";
$x = "     ab cd ef     \v\r\n" ;
echo strlen($x) . " characters: |" . $x . "|<br>";
$y = rtrim($x);
echo strlen($y) . " characters: |" . $y . "|</pre></p>";

#
# trim();

echo "<p><pre>                trim()";
echo "<br>                ------------------<br>";
$x = "  \v\r\n   ab cd ef  \v\r\n   " ;
echo strlen($x) . " characters: |" . $x . "|<br>";
$y = trim($x);
echo " " . strlen($y) . " characters: |" . $y . "|</pre></p>";

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-03-20 05:54 UTC] stas@php.net
Works for me perfectly - except that \v is not recognized by
PHP. Who needs it anyway?.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Oct 14 07:01:29 2024 UTC