There is a style file. You need to change the size of each font to a predetermined amount.

At the entrance

body { font-size: 13px; } .style1 { font-size: 18px; } 

etc

At the exit

 body { font-size: 15px; } .style1 { font-size: 20px; } 

Internets write that regulars do not support arithmetic expressions, but there can be some sort of loophole ...

  • regulars to help - Edward

1 answer 1

Use a regular expression replacement with the preg_replace_callback callback function

 $css = <<<CSS body { font-size: 13px; } .style1 { font-size: 18px; } CSS; $inc = 2; $css = preg_replace_callback( "/(font-size:\s*)(?<size>\d+)px/im", function($matches) use ($inc){ return $matches[1].($matches['size'] + 2)."px"; }, $css ); print_r($css); 

get the desired output

 body { font-size: 15px; } .style1 { font-size: 20px; } 

There is, of course, a nuance that the font can be set as font: 20px Tahoma ; . For replacement by several masks you can use preg_replace_callback_array()

  • Thank! What you need !!! - Dimas