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 Quote Link to comment 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] Quote Link to comment 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] Quote Link to comment 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. Quote Link to comment 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] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.