The preg_replace() function makes it very easy to change data between a starting character and ending the character. The example code below demonstrates how it can be used to remove anything in between angle brackets(<>) and in between regular brackets.
include('connect.inc'); $db = public_db_connect(); $command = "SELECT * FROM cms "; $result = mysqli_query($db, $command); while($row = mysqli_fetch_assoc($result)){ $tags = $row['mid']; echo "Look at source code:".$tags."</br/>"; $tag = preg_replace('#\<.*?\>#s', '', $tags); echo $tag; } $brackets = "(in brackets)"; echo "<br/>".$brackets; $no_brackets = preg_replace('#\(.*?\)#s', 'no brackets', $brackets); echo "<br/>".$no_brackets;
© 2018 ALL Rights Reserved | Sitemap
Vancouver | North Vancouver | Burnaby | Richmond | Coquitlam | Port Coquitlam | Surrey | Langley | Maple Ridge | Mission | Abbotsford | Kamloops | Kelowna | Victoria | Squamish | Whistler | Pemberton