top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

In PHP how to remove end of slash in url ?

+2 votes

Hi,I have a url some thing like this need to replace end of slash in the url.

I need url like this

posted Sep 29, 2014 by Manish Tiwari

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

trim( $str, "/" ); is probably your best/fastest bet.

answer Oct 5, 2014 by Rajneesh
Similar Questions
+2 votes

I want to build a A URL Shortener service in my PHP based Website without use of any thirdparty tool. Any clue or opensource would be a great help?

+1 vote

I'm adding some minification to our cache.class.php and am running into an edge case that is causing me grief.

I want to remove all comments of the // variety, HOWEVER I don't want to remove URLs...

Given some example text here with carefully crafted cases:

// another comment here

function bookmarksite(title,url){
 if (window.sidebar) // firefox
 window.sidebar.addPanel(title, url, "");
 else if(window.opera &
 else if(document.all)// ie
 window.external.AddFavorite(url, title);

I've tried so many variations and hunted on StackOverflow, Google, etc. and what would seem like a task already solved, doesn't seem to be.

This is "close", but still matches // (omitting the : of course)

s*(?!:)//.*?$ (count it as '/m' multiline)

This ultimately ends up in a PHP line of code like so:

$sBlob = preg_replace("@s*//.*?$@m",'',$sBlob);

Here are some other links of stuff I've found and tried to experiment with varying degrees.

0 votes

I would like to know how can I pass a parameter via URL using control value on the form.
Something like myPage.php?MyID=txtMyID.value
I can use myPage.php?MyID=1, but cannot use myPage.php?MyID=txtMyID.value.