Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

How to filter html tags like

& and only convert the text part in php?

For Example:

"<p>g]kfn <span style="font-family:arial;">/</span> g]kfn</p>"

above string is my input and I need to filter HTML <p></p>, <span style="font-family:arial;">/</span> and only convert g]kfn this text and get the result in same format as input string.

$translatedResult = str_replace(
            ["c","cf","f","O","O{","{","p","P","]","}","f]","f}","cf]","cf}","+","F","l","L","'",'"',"s","v","u","3","ª","r","5","h","´","`","6","7","8","9","0f","t","y","b","w","g","k","km","a","e","d","o","/","?","[","n","j",";","z","if","1","x","!","@","#","$","%","^","&","*","(",")",".","\\","pm"," ","-","_"], 
            ["अ","आ","ा","इ","ई","र्","उ","ए","े","ै","ो","ौ","ओ","औ","ं","ँ","ि","ी","ु","ू","क","ख","ग","घ","ङ","च","छ","ज","झ","ञ","ट","ठ","ड","ढ","ण","त","थ","द","ध","न","प","फ","ब","भ","म","य","र","रू","ृ","ल","व","स","श","ष","ज्ञ","ह","१","२","३","४","५","६","७","८","९","०","।","्","ऊ","-","(",")"], 
            $input_string);

I tried with about code but it converted all.

The required result should be:

"<p>नेपाल <span style="font-family:arial;">/</span> नेपाल</p>"

Comments