¡@

Home 

php Programming Glossary: printedlength

PHP: Truncate HTML, ignoring tags

http://stackoverflow.com/questions/1193500/php-truncate-html-ignoring-tags

utf 8' function printTruncated maxLength html isUtf8 true printedLength 0 position 0 tags array For UTF 8 we need to count multibyte.. # a zA Z0 9 x80 xFF x80 xBF ' ' a z ^ # a zA Z0 9 ' while printedLength maxLength preg_match re html match PREG_OFFSET_CAPTURE position.. the tag. str substr html position tagPosition position if printedLength strlen str maxLength print substr str 0 maxLength printedLength..