I have the following array.
$state = array("gujarat","andhra_pradesh","madhya_pradesh","uttar_pradesh");
Expected Result
$state = array("Gujarat","Andhra Pradesh","Madhya Pradesh","Uttar Pradesh");
I want to convert array values ββwith every first character of a word using UpperCase and replace _ with space . So I do this using this loop, and it works as expected.
foreach($states as &$state) { $state = str_replace("_"," ",$state); $state = ucwords($state); }
But my question is: is there any PHP function to convert the entire array according to my requirement?
arrays php
Sadikhasan
source share