Created
April 16, 2018 13:57
-
-
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.
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 | |
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