Question

This works to combine ucwords and str_replace if I only need to replace one character:

echo str_replace('_', ' ', ucwords($cname));

This works to replace words/characters:

$search_name = array('_', ',', 'neckline', 'skirts', 'skirt','pants', 'neckline_size', 'sleeves', 'pants_length');
$replace_name = array(' ', ', ', '');
$rows = str_replace($search_name, $replace_name, $row);
echo $rows['silhouettes_like'];

But if I try combining them by adding this, it echo's "Array" instead of the value

$style_names = ucwords($rows);
Was it helpful?

Solution

Looks like you want the array_map function to map ucwords to each row value

$rows = array_map('ucwords', $rows);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top