I want to convert all sizes in a html document. Everything with **px should be divided by 4. So 100px would become 25px.
For example:
<div style="height:100px;"></div>
should become
<div style="height:25px;"></div>
Here is a php code I wrote. But it doesn’t work.
$content = "<div style=\"height:100px;\"></div>";
$regex = "#([0-9]*)px#";
$output = preg_replace($regex,"$1/4",$content);
How do I do?
As an alternative to
preg_replace_callback, you can use theemodifier to evaluate the replacement as php: