Fantastic! it works, thank you both of you. Here is the code I used:
// Extract username from url
$slash_storename = parse_url($store_url, PHP_URL_PATH);
// Removes slash
$slash = array("/");
$store_name = str_replace($slash, "", "$slash_storename");
echo "storename without slash is: $store_name";
Once again thank you. 🙂