I currently have a code like this:
$insert = "how are you today? nice to see you again. here is your login ";
$wwwcheck = $nameinput;
if(preg_match("/name1|name2|name3|name4/i", $nameinput)) {
$tpl = str_replace('name1 ', $insert . '<a href="/folder/name1/">name1</a> ', $tpl);
$tpl = str_replace('name2 ', $insert . '<a href="/folder/name2/">name2</a> ', $tpl);
$tpl = str_replace('name3 ', $insert . '<a href="/folder/name3/">name3</a> ', $tpl);
$tpl = str_replace('name4 ', $insert . '<a href="/folder/name4/">name4</a> ', $tpl);
}
which has 60 lines and is only going to keep getting bigger. Is there anyway to shrink the principal down to a single line?
e.g.
$insert = "how are you today? nice to see you again. here is your login ";
$wwwcheck = $nameinput;
if(preg_match("/name1|name2|name3|name4/i", $nameinput)) {
$tpl = str_replace('$name ', $insert . '<a href="/folder/$name/">$name</a> ', $tpl);
}
Really struggling.
Thanks
Mike