im having a problem. I have field in my database where a user can put a facebook url. What i need to do is to check if the data is a url, parse it and just return the username after the / in the url.
An example:
if the database says https://www.facebook.com/username just username if says www.facebook.com/username same if says just the username just show the username
i have tried it like this:
$url = $facebook;
if (strpos($url,'https://') == true){
$facebook = str_replace('https://', '', $url );
$facebook = substr(strrchr($url, '/'), 1);
}
else
{
$facebook = $facebook;
}
explode()andend()->$facebook = end(explode('/',$facebook));