Skip to content

Instantly share code, notes, and snippets.

@mdjwel
Created April 16, 2018 13:57
Show Gist options
  • Save mdjwel/3b1da3945882bf64a0ce1fd346f43431 to your computer and use it in GitHub Desktop.
Save mdjwel/3b1da3945882bf64a0ce1fd346f43431 to your computer and use it in GitHub Desktop.
Make associative icon array ('icon_class'=> 'Icon Name' paired) from css classes indexed array.
<?php
function chaoz_icon_array($k) {
$v = array();
foreach ($k as $kv) {
$kv = str_replace('-', ' ', $kv);
$kv = str_replace('icon', '', $kv);
$v[] = array_push($v, ucwords($kv));
}
foreach($v as $key => $value) if($key&1) unset($v[$key]);
return array_combine($k, $v);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment