evGetPermalink | generates a slug or permalink of a given string


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. // name: evGetPermalink
  2. // version: v0.1
  3. // description: generates a slug or permalink of a given string
  4.  
  5. function evGetPermalink( $text ) {
  6.  
  7. $permalink = preg_replace('/[^a-zA-Z0-9-_ ]/', '', $text);
  8. $permalink = mb_strtolower( strtr( $permalink, " ", "-" ) );
  9. return $permalink;
  10. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.