phporcaffeine Posted May 9, 2006 Share Posted May 9, 2006 $data = "bin/IT_Department/ryan.vpg";$trm = ltrim (strtolower($directory), "bin/");echo $trm;//RESULT IS:"t_department/ryan.vpg";Why is it taking the " I " along with " bin/ "?PLEASE HELP!@#, lolTIA Link to comment https://forums.phpfreaks.com/topic/9415-string-problems/ Share on other sites More sharing options...
michaellunsford Posted May 9, 2006 Share Posted May 9, 2006 because "I" is in your strip list :-)[a href=\"http://us3.php.net/ltrim\" target=\"_blank\"]http://us3.php.net/ltrim[/a] Link to comment https://forums.phpfreaks.com/topic/9415-string-problems/#findComment-34688 Share on other sites More sharing options...
obsidian Posted May 9, 2006 Share Posted May 9, 2006 if you're after exact matching like that, why not use str_replace or preg_replace instead?[code]$data = "bin/IT_Department/ryan.vpg";$data = str_replace("bin/", "", $data);echo $data;[/code] Link to comment https://forums.phpfreaks.com/topic/9415-string-problems/#findComment-34692 Share on other sites More sharing options...
phporcaffeine Posted May 9, 2006 Author Share Posted May 9, 2006 Call it a moment of absentism but I was trying to do a regex match with ltrim() thats why it was confusing me. As suggested, I fixed the issue with str_replace. Link to comment https://forums.phpfreaks.com/topic/9415-string-problems/#findComment-34706 Share on other sites More sharing options...
Barand Posted May 9, 2006 Share Posted May 9, 2006 .. or[code]$data = "bin/IT_Department/ryan.vpg";$data = substr($data, 4);[/code] Link to comment https://forums.phpfreaks.com/topic/9415-string-problems/#findComment-34745 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.