Slide 41
Slide 41 text
public function normalizeTwitter($string)
{
$string = str_replace('https://', '', $string);
$string = str_replace('http://', '', $string);
$string = str_replace('mobile.twitter.com/', '', $string);
$string = str_replace('twitter.com/', '', $string);
if (substr($string, 0, 1) === '@'){
$string = substr($string, 1);
}
if (substr($string, -1, 1) === '/'){
$string = substr($string, 0, -1);
}
return $string;
}