I have a textarea where I can type in multiple domain names to check availability.
In my script below I replace space with “-“. But I also want a version of the domain name without “-”.
Say for example that I type in:
a good word
a nother god word
Then I want the script to return both:
a-good-word
a-nother-god-word
And also:
agoodword
anothergodword
$domaininput = (isset($_POST['domainname'])) ? $_POST['domainname'] : '';
$change_space = str_replace(" ","-",$domaininput);
$change_new_line = str_replace("\n",",",$change_space);
$manydomains = explode("," , $change_new_line);
foreach ($manydomains as $domain){
//some code
}
How can that be done in PHP?
1 Answer