I am trying to write a script that replaces some html tags into other or more html tags. Choose preg_replace because of the nice effect with variables in it. For Example:
$xhtmlcode = preg_replace('@<h(.*?)>(.*?)</h(.*?)>@is','<h$1><sub>$2</sub></h$3>', $xhtmlinput);
This above code works and gives me an expecting result, but then after it i do a:
$xhtmlcode = preg_replace('@<li(.*?)>(.*?)</li>@is','<li><sub>$2</sub></li>', $xhtminput);
just pays NULL as output..
The same thing happens when work with other code like this, now I realy like to know why this happens:
$xhthmlintput = '
<span style="font-style:italic;font-weight:bold;font-size:12.5px">this is the test world</span>
<span style="font-size:5.5px">this is the test planet</span>
<span style="font-size:5.5px">test it well</span>';
AND i got the same problem again with:
$xhtmlcode = preg_replace( '@<span style="(.*?)bold(.*?)>(.*?)</span>@i', '<b>$3</b>', $xhtmlintput );
I get troubles again with a NULL as output again.