This function below returns a string of values separated by commas
$key_1_value = get_post_meta(422,'keywords',true);
The output in my browser looks like this: red, white, blue, blue two , green, yellow, purple, magenta , cyan, black
I am trying to trim the space before and after all the values.
So I used this code to try to trim spaces, but it is still there. Why doesn't this crop the values?
$test = array($key_1_value); $trimmed_array=array_map('trim',$test); print_r($trimmed_array);
source share