Quick Search:
 
 PHP Code: Get Link Text Jump to:  
Category: >> PHP Code >> Get Link Text  

<< lastnext >>

Snippet Name: Get Link Text

Description: Gets just the text of a URL link.

Also see:
» Truncate Links Over X Chars long
» Nice 'Read More...' links
» Auto Link Maker #2
» Secure Auto-Link Maker
» Auto Link Maker

Comment: (none)

Language: PHP
Highlight Mode: PHP
Last Modified: March 16th, 2009

<?PHP
 
FUNCTION getUrlLinkText($url){
 
    PREG_MATCH('/\>(.*)<\/a>/', $url, $matches);
    /*** return the match ***/
    RETURN $matches[1];
}
 
/* example usage 
 
$url = '<a href="http://www.domain.com" class="something" id="link_id">Url Text Link Here</a>';
echo getUrlLinkText($url);
 
*/
 
?>


 
   Home |    Search |    Code Library |    Sponsors |    Privacy |    Terms of Use |    Contact Us © 2003 - 2024 psoug.org