I have a string like this
JavaScript
x
.header{
font-family:;
background-color:red;
color:blue;
line-height:;
}
.footer{
background-color:green;
color:;
}
I want to convert this string-like this
JavaScript
.header{
background-color:red;
color:blue;
}
.footer{
background-color:green;
}
How can I achieve this?
Advertisement
Answer
Try:
JavaScript
preg_replace('/.*:s*;/i', '', $string);
although, the output would include color:blue;
too and not just background-color:red;
for .header
?