tags:

views:

84

answers:

2

Here is my string:

usercss:body background: red, #header: background: #fff;

I want to remove usercss:

body background: red, #header: background: #fff;

Then explode by , (comma) to produce a list like so:

body {
background: red;
}
#header {
background: #fff;
}

Might be tricky to get the curly brackets in {} but if somebody could help me explode it into a list like:

body background: red; #heeader background: #fff;

That would be a great help!

+1  A: 
$content=substr($content,strlen('usercss:'));
$arr=split(",",$content);
Pentium10
wouldn't it be strlen('usercss:') ?
jellyfishtree
yeah it is, edited
Pentium10
A: 

As of PHP5.3 you can also use http://de.php.net/manual/en/function.strstr.php

$content = strstr($content, 'usercss', true);

instead of substr.

Gordon