Skip to content

Instantly share code, notes, and snippets.

@bobbydank
Last active January 25, 2023 19:02
Show Gist options
  • Save bobbydank/6f02df8ec96c890021d7aea9fea98fbc to your computer and use it in GitHub Desktop.
Save bobbydank/6f02df8ec96c890021d7aea9fea98fbc to your computer and use it in GitHub Desktop.
takes a string and makes a css class out of it.
<?php
function _classify($string) {
$string = preg_replace("/[^A-Za-z ]/", '', strtolower($string));
return str_replace(' ', '-', $string);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment