Skip to content

Instantly share code, notes, and snippets.

@renorram
Created December 1, 2017 14:05
Show Gist options
  • Save renorram/80bbcebe9fa23436b7be6a81d2a200c7 to your computer and use it in GitHub Desktop.
Save renorram/80bbcebe9fa23436b7be6a81d2a200c7 to your computer and use it in GitHub Desktop.
Replace accented characters
<?php
/**
* Replace accented characters
* @param $string
*
* @return string
*/
public function stripAccents($string)
{
return preg_replace('/[`^~\'"]/', null, iconv('UTF-8', 'ASCII//TRANSLIT', $string));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment