I have a string like this:
<span style="font-weight: bold;">Foo</span>
I want to use PHP to make it
<strong>Foo</strong>
…without affecting other span
s.
How can I do this?
$text='<span style="font-weight: bold;">Foo</span>';
$text=preg_replace( '/<span style="font-weight: bold;">(.*?)<\/span>/', '<strong>$1</strong>',$text);
Note: only work for your example.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With