Created
February 24, 2016 21:16
-
-
Save ibourgeois/18d73614f15f63796d18 to your computer and use it in GitHub Desktop.
PHP CSS Class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class CSS { | |
public function __construct() { | |
} | |
public function new($selector, $rules) { | |
$css = $selector.'{'; | |
foreach ($rules as $property => $value) { | |
$css .= $property.':'.$rule.';'; | |
} | |
$css .= '}'; | |
return $css; | |
} | |
} | |
/* | |
----- EXAMPLE ----- | |
CSS::new('#test', array( | |
'background' => '#ffffff', | |
'color' => '#222222' | |
)); | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment