Welcome to WebmasterWorld Guest from 54.226.25.231

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

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

     

tnet21

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

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

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



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

'#http://(.*)#'
 

Featured Threads

Hot Threads This Week

Hot Threads This Month