retoto Posted November 24, 2007 Share Posted November 24, 2007 Hi all i search some lil function to spilt if i have sote/dfd/dfd.index.php soo i spilt tow / and if i print after the spilt i got dfd.index.php if somt one can give me function for that .. thanks alot ! Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted November 24, 2007 Share Posted November 24, 2007 explode() www.php.net/explode Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted November 24, 2007 Share Posted November 24, 2007 function for what ? have your already got a function ? there are various ways to do that $str = "sote/dfd/dfg.index.php"; $strReturn = implode("",explode("/",$str)); but I would just suggest str_replace $str = "sote/dfd/dfg.index.php"; $strReturn = str_replace("/","",$str); Quote Link to comment Share on other sites More sharing options...
odisey Posted November 24, 2007 Share Posted November 24, 2007 I am not sure if this snippit is helpful. You may modify it to accomplish what you are trying to accomplish though. // Check for a trailing slash or HERE YOU MODIFY TO CHECK FOR WHAT YOU WANT TO SPLIT if ((substr($url, -1) == '/') OR (substr($url, -1) == '\\') ) { $url = substr ($url, 0, -1); // Chop off the slash. } // Add the page. $url .= '/index.php'; Maybe something like: // Check for a garbage if ((substr($url, -1) == 'sote/dfd/') OR (substr($url, -1) == 'sote\dfd\') ) { $url = substr ($url, 0, -1); // Split. } // Add the page. $url .= '/dfd.index.php; Quote Link to comment Share on other sites More sharing options...
retoto Posted November 24, 2007 Author Share Posted November 24, 2007 thanks you all all you help alot lol 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.