Jump to content

[SOLVED] Is it possible to strip string formats?


Solarpitch

Recommended Posts

Hey guys,

 

My application allows user's to format text before uploading to the database. It is then stored in the database as for example..

 

<strong>Header:</strong><br /><br />This is text inside...

 

Is their any php function or way to strip the format values when I want to display them in a result set on the page. So in theory, I want to have it displayed as normal.

 

Header: This is text... (without the bold and breaks)

strip_tags(). you can decide which tags are not stripped out OR you could use a preg_replace...

 

<?php
$takeout = array('/<(\/)?bold>/','/<(\/)?strong>/','/<br( \/)?>');

$str = preg_replace($takeout,'',$astring);

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.