note 95436 rejected from function.trim by danbrown
| From: | danbrown@php.net | Date: | Sun, 03 Jan 2010 16:15:16 +0000 |
| Subject: | note 95436 rejected from function.trim by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-164567@lists.php.net to get a copy of this message | ||
Note Submitter: mashdot at toshine dot net
----
Noticed strange behavior when trimming a directory off a file name starting with the letter
"o".
<?php
$filePath = 'blog/2010/oh-this-is-an-example';
$section = 'blog/2010';
echo ltrim($filePath, $section);
?>
result: h-this-is-an-example
Does anyone know what "/o" is and why this is stripped?
Current fix:
<?php
$filePath = 'blog/2010/oh-this-is-an-example';
$filePath = str_replace('/o', '/O', $filePath); //FIX for filenames beginning
with "o"
$section = 'blog/2010';
echo ltrim($filePath, $section);
?>
result: Oh-this-is-an-example