[Solved] Replace with php each font size=”” to font-size: ; how to? [closed]


You can use preg_replace(). http://php.net/manual/en/function.preg-replace.php

$str="Hello <font size="4">today</font> is my <font size="3">special day</font> and am <font size="11">ready</font> for it...";
preg_replace('/<font size="(\d+)">(.+?)<\/font>/', '<span style="font-size:$1;">$2</span>', $str)

Output:

Hello <span style="font-size:4;">today</span> is my <span style="font-size:3;">special day</span> and am <span style="font-size:11;">ready</span> for it...

4

solved Replace with php each font size=”” to font-size: ; how to? [closed]