Created
December 6, 2016 21:50
-
-
Save nicelife90/9dcd6ef4c2fb401f525cb6dde8219c65 to your computer and use it in GitHub Desktop.
Font Awsome to PHP Array
This file contains 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 | |
$pattern = '/\.(fa-(?:\w+(?:-)?)+):before\s+{\s*content:\s*"\\\\(.+)";\s+}/'; | |
$subject = file_get_contents($_SERVER['DOCUMENT_ROOT'].'/css/font-awesome/css/font-awesome.css'); | |
preg_match_all($pattern, $subject, $matches, PREG_SET_ORDER); | |
echo '$fa_icon = ['; | |
foreach($matches as $match) { | |
echo "'$match[1]' => '<li class=\"fa $match[1]\"></li>',\n"; | |
} | |
echo ']'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment