Hello. Help, please, make a regular schedule.

There is a variable that contains the table <table> <tr> <td> ... </ td> </ tr> </ table>, in some cells there are links <a href = "..."> sometext </ a>

It is required to remove from the variable only the link tags, leaving their anchors, i.e., sometext

Thank.

I will give an example at the request

<table><tr> <td><a href="http://fsdfsd.ru">Π‘Π°ΠΉΡ‚</a> ΠΊΠΎΠΌΠΏΠ°Π½ΠΈΠΈ</td> <td>Какая-Ρ‚ΠΎ информация</td> </tr></table> 

It should work

 <table><tr> <td>Π‘Π°ΠΉΡ‚ ΠΊΠΎΠΌΠΏΠ°Π½ΠΈΠΈ</td> <td>Какая-Ρ‚ΠΎ информация</td> </tr></table> 
  • write an example of what should work - L. Vadim
  • added an example for you - Alexander Vladimirovich

1 answer 1

 echo preg_replace('#<a.*?>([^>]*)</a>#i', '$1', $str);