Я хочу убрать теги со значения внутри array_values () перед развертыванием с помощью вкладок.
Я пробовал с этой строкой ниже, но у меня есть ошибка,
$output = implode("\t",strip_tags(array_keys($item)));
в идеале я хочу убрать разрывы строк, двойные пробелы, символы табуляции со значением,
$output = implode("\t",preg_replace(array("/\t/", "/\s{2,}/", "/\n/"), array("", " ", " "), strip_tags(array_keys($item))));
но я думаю, что мой метод не верен!
это вся функция,
function process_data($items){
# set the variable
$output = null;
# check if the data is an items and is not empty
if (is_array($items) && !empty($items))
{
# start the row at 0
$row = 0;
# loop the items
foreach($items as $item)
{
if (is_array($item) && !empty($item))
{
if ($row == 0)
{
# write the column headers
$output = implode("\t",array_keys($item));
$output .= "\n";
}
# create a line of values for this row...
$output .= implode("\t",array_values($item));
$output .= "\n";
# increment the row so we don't create headers all over again
$row++;
}
}
}
# return the result
return $output;
}
Пожалуйста, дайте мне знать, если у вас есть идеи, как это исправить. Спасибо!