I have a CSS file with numeric values with appending px like "width: 500px;". I need to read this file from start to end using php and alter all numeric values wherever found .i.e. convert 500px to some thing else like 50% of it (width: 250px). How can we do this, maybe using regex.
$file = fopen("file.css", "r+") or exit("Unable to open file!");
while(!feof($file))
{
if(numeric value between space and px)
//replace by its 50%
}
fclose($file);
This code is just to explain problem, solution can be entirely different.
is_numeric()is_numeric()doesn't work in this case.