dgmike
12/11/2010 - 11:15 PM

Simplifica uma string usando htmlentities

Simplifica uma string usando htmlentities

<?php

$string = utf8_decode('Acentuação de casos     grandes    ');
$str = strtolower($string);
$str = trim($str);
$str = htmlentities($str);
$str = preg_replace('@\&(\w)[^;]+;@', '\1', $str);
$str = preg_replace('@\s+@', '-', $str);

print $str;