php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46242 Ltrim-Rtrim Palindrome Syndrome
Submitted: 2008-10-06 15:15 UTC Modified: 2008-10-06 15:49 UTC
From: can at berkol dot net Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.2.6 OS: Windows Vista
Private report: No CVE-ID: None
 [2008-10-06 15:15 UTC] can at berkol dot net
Description:
------------
Maybe there is a reasoning beyond this. However, unexpected output is produced with ltrim and rtrim if the string has a palindrome-'like' structure.

Reproduce code:
---------------
$str = 'daobcd';
echo ltrim($str, 'dao')

$str = 'daoabc';
echo ltrim($str, 'dao') /

$str = 'bcsedeo';
echo rtrim($str, 'deo');

Expected result:
----------------
1. bcd

2. abc

3. bcse

Actual result:
--------------
1. bcd

2. bc

3. bcs

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-10-06 15:16 UTC] can at berkol dot net
ignore syntax error .... I made mistakes during copying and pasting from one textbx to another...
 [2008-10-06 15:49 UTC] bjori@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 28 08:00:03 2025 UTC