$url = "http://facebook.com/facebook"; $sonurl = str_replace("http://facebook.com","http://graph.facebook.com",$url); echo $sonurl;