Posted By

sveggiani on 01/03/09


Tagged

strings evFunctions


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

luman


evGetPermalink | generates a slug or permalink of a given string


 / Published in: PHP
 

  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  

You need to login to post a comment.