homepage Welcome to WebmasterWorld Guest from 54.242.231.109
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Best way to strip "http://" in simple PHP code
tnet21




msg:4471506
 1:59 pm on Jul 1, 2012 (gmt 0)

I have a code like this:

<div class="left">&copy; <a href="<?php bloginfo('url'); ?>">="<?php bloginfo('url'); ?></a> | <a href="<?php bloginfo('url'); ?>/sitemap_index.xml">Sitemap</a></div>

, and it is showing the following result:

C [domain-name.com...] | Stemap


I am wondering if there is any simple way to get rid of "http://" string using PHP ("inline", without using variables etc, like in some tutorials online)


Thank you.

 

g1smd




msg:4471526
 4:29 pm on Jul 1, 2012 (gmt 0)

Use preg_match to match all after the http:// part using:

'#http://(.*)#'
Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved