Page 1 of 1

Removing certain text with PHP?

Posted: Wed Aug 11, 2010 2:59 pm
by dominod
Hi

I want this URL:

php.net/manual/en/function.explode.php

to become

php.net

using php ..

I tried with the explode fuction but couldnt get it to work ...

Code: Select all

list ($finalurl, $blabla) = explode('/', $url);
Anyone have any tips?

Thanks in advance :)

Re: Removing certain text with PHP?

Posted: Wed Aug 11, 2010 3:13 pm
by josh
Regular expressions

Re: Removing certain text with PHP?

Posted: Wed Aug 11, 2010 5:56 pm
by John Cartwright

Code: Select all

echo '<pre>'. print_r(parse_url('php.net/manual/en/function.explode.php'), true) .'</pre>';

Re: Removing certain text with PHP?

Posted: Thu Aug 12, 2010 9:06 am
by dominod
Thanks :)