You are using string concatenation to create
$tog
(
PHP: String Operators - Manual[
^]). So that is a string variable containing only a single value.
You might create a concatenated string by inserting a separation character:
$tog = $name1 . '.' . $name2;
Then it can be later splitted into the original strings provided that those did not contain the separation character.
You might use a string array instead (
PHP: Arrays - Manual[
^]):
$tog = array($name1, $name2);
To print all values from such an array:
$count = count($array);
for ($i = 0; $i < $count; $i++) {
if ($count > 0) {
echo ".";
}
echo $array[$i];
}
echo "\n";