View Full Version : List CSS Styles

07-29-2007, 04:50 AM
Does anyone have any idea how I could create an array of all the css styles I have in a .css file. I need to be able to create a list of them all, and sort them alphabetically.

07-29-2007, 06:07 PM
First you start with file_get_contents (http://www.php.net/manual/en/function.file-get-contents.php).
Or similar function to read your .css file.

After you should use something like preg_match (http://www.php.net/manual/en/function.preg-match.php) or similar function, with some wicked regular expresion to get only you css names, and a function to store those matches in array.

Sorting by name would be an easier job in your program.

I hope this helped. But you should know that reading files, and using regular expressions are one of the hardest things to do for a PHP programmer. (eg. a search script)