strip tags - Why doesn't strip_tags work in PHP? -
i've got following code:
<?php echo strip_tags($firstarticle->introtext); ?>
where $firstarticle stdclass object:
object(stdclass)[422] public 'link' => string '/maps101/index.php?option=com_content&view=article&id=57:greenlands-newest-iceberg&catid=11:geography-in-the-news' (length=125) public 'text' => string 'greenland's newest iceberg' (length=26) public 'introtext' => string '<p>a giant chunk of ice calved off petermann glacier on northwest side of greenland summer. @ 100 square miles (260 sq. km) in size, 4 times size of manhattan, th' (length=206) public 'date' => object(jdate)[423] public '_date' => int 1284130800 public '_offset' => int 0 public '_errors' => array empty
you can see $firstarticle->introtext refers string:
"<p>
a giant chunk of ice calved off petermann glacier on northwest side of greenland summer. @ 100 square miles (260 sq. km) in size, 4 times size of manhattan, th"
the <p>
tag problem me in application, strip_tags absolutely refuses remove , can't figure out why. gave on strip_tags , attempted preg_replace instead regex /<(.|\n)*?>/ :
preg_replace('/<(.|\n)*?>/', '', $firstarticle->introtext);
but didn't work either! how can strip html tags (matched or not) string when output it?
try:
<?php echo strip_tags(html_entity_decode($firstarticle->introtext)); ?>
Comments
Post a Comment