Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to remove speacial characters from a string in php?

i am working on a php site

from the admin panel i am updating the data of content to be shown on a page using wysig editor

which add <p> </p> by default has opening and closing tags while inserting in mysql table

and when i show it on pages it comes has

        <?> with some black bakground

along the content why so how can i remove or filter it dynamically while pulling records

for example

      // content goes in to website
      $ a = "<p> this content </p>" ;

i wana display it has

         "this content" 

any help will be appreciated

like image 318
Rinzler Avatar asked Mar 14 '26 16:03

Rinzler


2 Answers

Try This

$a = "<p> this content </p>" ;
$var = strip_tags($a);
echo $var
like image 109
Query Master Avatar answered Mar 17 '26 05:03

Query Master


If you only need to remove HTML tags, you should use strip_tags().

http://php.net/manual/en/function.strip-tags.php

like image 37
Simone Avatar answered Mar 17 '26 06:03

Simone



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!