regex - php get current url & remove word -


I have read so much that I have confused beyond my reasons.

What I need (with PHP)) to be able to get the URL of current page , and then miss a specific word and it was displayed on the page.

Example URL: http: //domain.com/some/thing/word

Example output: http://domain.com / Some / thing /

So far, I managed to do one or the other, but when I try to do all this together, then I break things.

Any help is greatly appreciated.

You can try the code below to remove the last word characters in your URL,

  & lt; Php echo preg_replace ('^ (. * \ /.) * $ ~', '$ 1', 'http://domain.com/some/thing/word'); ? & Gt; // = & gt; Http://domain.com/some/thing/  

Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -