Skip to content

Instantly share code, notes, and snippets.

@wurin7i
Created April 12, 2013 07:44
Show Gist options
  • Save wurin7i/5370273 to your computer and use it in GitHub Desktop.
Save wurin7i/5370273 to your computer and use it in GitHub Desktop.
Menghilangkan duplikat kata. Implentasi untuk slug efisien
$str = 'laki-laki harus berani';
$str = preg_replace('~([^\s\-]+)[\s\-]\1~', '\1', $str);
echo $str;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment