$val = array_map(function($a){ return "{".$a."}"; }, array_values($arr));
preg_split('/[\W_]/u', trim($pizza), -1, PREG_SPLIT_NO_EMPTY);
<?php
$pizza = "Я тут был! ongli";
$pieces = preg_split("/ |\n/", $pizza);
foreach ($pieces as $w) {
$f = fopen($w.".html", "c+");
fwrite($f, $w);
}