QAds
Sony VAIO VPC-CW21FX/W Laptop
$618.74
Canon Digital Rebel XSi 12.2 MP Digital SLR Camera with EF-S 18-55mm f/3.5-5.6 IS Lens (Black)
$363.00
Apple iPod nano 8 GB Yesil
$88.21
Nikon D90 DX 12.3MP Digital SLR Camera with 18-105mm f/3.5-5.6G ED AF-S VR DX Nikkor Zoom Lens
$0.69
:: HOME PHP How can I remove links from content?
 
How can I remove links from content?
How can I remove links from content? I read some WEBsite content and it has so many links inside and I want to remove all links from it. how can I do that?
at first you need to take string between <a></a> tags and then you need to replace it. you can use below code to do that.

 
 
Code
$text = '.. content here ...';
$p1 = strpos($text, '<a href=');
$p2 = (strpos($text, '</a>') 4) - $p1;
$rep = substr($text, $p1, $p2);
echo str_replace($rep, '',$text);