Removing certain text with PHP?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dominod
Forum Commoner
Posts: 75
Joined: Wed Jun 30, 2010 7:18 am

Removing certain text with PHP?

Post 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 :)
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: Removing certain text with PHP?

Post by josh »

Regular expressions
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: Removing certain text with PHP?

Post by John Cartwright »

Code: Select all

echo '<pre>'. print_r(parse_url('php.net/manual/en/function.explode.php'), true) .'</pre>';
dominod
Forum Commoner
Posts: 75
Joined: Wed Jun 30, 2010 7:18 am

Re: Removing certain text with PHP?

Post by dominod »

Thanks :)
Post Reply