So I have 开发者_StackOverflow中文版this foreach loop - and I want to modify the array based on my modification of the values. However when I try to later convert $bizaddarray to a string, all of the HTML tags are still present. Here's my foreach loop - how can I make the strip tags permanent?
foreach ($bizaddarray as $value) {
strip_tags(ucwords(strtolower($value)));
}
Two ways, you can alter the memory location shared by the current value directly, or access the value using the source array.
// Memory reference
foreach ($bizaddarray as &$value) {
$value = strip_tags(ucwords(strtolower($value)));
}
unset($value); # remove the reference
Or
// Use source array
foreach ($bizaddarray as $key => $value) {
$bizaddarray[$key] = strip_tags(ucwords(strtolower($value)));
}
foreach ($bizaddarray as $key => $value) {
$bizaddarray[$key] = ucwords(strtolower($value));
}
精彩评论