iwarlord Posted August 28, 2008 Share Posted August 28, 2008 hi everyone. I hope somebody can help me. I'm attempting to convert a css file into an array such as Array ( [0] => Array ([.classname1] => padding:0px;margin:0px;) [1] => Array ([.classname1] => color:#000;) ... ) which would simple enough if it weren't for groups which I'm trying to get as Array ( [0] => Array ([.class1] => font-size:1em;[.class2] => font-size:1em;[.class3] => font-size:1em;) ... ) and child classes I'm trying to get as Array ( [0] => Array ([.class1] => Array ([.class2] => Array ([.class3] => Array ([.class4] => color:blue;) ) ) ) ... ) so basically i want to convert this example string... .class1, class2, class3{font-size:1em;} .class1 .class4{color:#fff;} .class1 .class5{color:#ccc;} #id1, #id2, #id3{font-size:2em;} into this Array ( [0] => Array ( [.class1] => Array([.class4]=>color:#fff; [.class5]=>color:#ccc;) [.class2] => font-size:1em; [.class3] => font-size:1em; ) [1] => Array ( [#id1] => font-size:2em; [#id2] => font-size:2em; [#id3] => font-size:2em; ) ) I'm getting in a real muddle doing this. Has anybody done this before please? Link to comment https://forums.phpfreaks.com/topic/121736-css-file-to-array-help/ Share on other sites More sharing options...
papaface Posted August 28, 2008 Share Posted August 28, 2008 why? Link to comment https://forums.phpfreaks.com/topic/121736-css-file-to-array-help/#findComment-628045 Share on other sites More sharing options...
BlueSkyIS Posted August 28, 2008 Share Posted August 28, 2008 why? haha. that was my first thought, but i held my tongue. Link to comment https://forums.phpfreaks.com/topic/121736-css-file-to-array-help/#findComment-628065 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.