Hi friends
I have a problem, problem is that I have an array in php like as :
$arr=array("ram","mohan","shyam","vineet");
I want to first character of every word will be in upper case ? Please tell me anyone ,how to do this ?
Please help me ?
Thanks
Loading

Vineet Kumar SainiPosted Sep 19, 2012, 2:27 AM
Rohatash KumarPosted Sep 18, 2012, 11:36 PM
Firstly You need foreach loop to all the element of array and use the function ucwords. it convert first letter of word in uppercase.
Rohatash
Satyapriya NayakPosted Sep 18, 2012, 12:17 PM
Try this...
$arr=array("ram","mohan","shyam","vineet");
foreach ($arr as $key => $val)
{
print_r(ucwords($val));
echo '
';
}
?>
Thanks
If this post helps you mark it as answer
Akkiraju IvaturiPosted Sep 18, 2012, 11:02 AM
You need to loop through all the elements in the array and use the function to make the first letter of word as uppercase and then add it to another array.
Let me know if you have any questions.