Skip to content

Instantly share code, notes, and snippets.

@hexathos
Last active June 12, 2016 05:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hexathos/74de75cb7754db54ab15b42798a839ea to your computer and use it in GitHub Desktop.
Save hexathos/74de75cb7754db54ab15b42798a839ea to your computer and use it in GitHub Desktop.
Get unicode hexadecimal value from fontawesome's _variables.scss (works on 4.6.3)
<?php
// For example if you need to print a fontawesome icon on an image... or as dropdown in a select box...
// works with fontawesome 4.6.3
// proof of concept, maybe a bit slow -.-
$in = file_get_contents('_variables.scss');
$out = array();
preg_match_all("/fa-var-(.*): \"\\(.*)\";/", $in, $out);
$result = array();
$count=0;
foreach($out[1] as $name) {
$result[$name] = $out[2][$count];
$count++;
}
/*
print_r($result);
access via $result["archive"] for example .
echo "&\#x".$result["archive"].";";
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment