First off, as a general coding practice, try to do a little amount of <?php ?> in your page as possible. This reduces performance drastically. 2nd you don't need to put () around anything you want to echo.
- $counter = 1 ;
-
echo $name[$counter];
If your only getting the 1st character of the $name in your foreach iteration, then whatever is being returned through the $name variable is a string.
In PHP if you want a specific character of a string variable, you can access it as if it were an array.
- $str = 'hello world';
-
echo $str[0]; // h
-
echo $str[6]; // w