- substr: documentation ( source)
<?php
function get_excerpt( $text, $length = 200, $append = '...' ) {
if( strlen( $text ) < $length ) {
return $text;
}
else {
$excerpt = substr( $text, 0, $length );
$excerpt .= $append;
return $excerpt;
}
}
$rt = "hellokkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk";
echo lenght.$rt;
echo get_excerpt("")
?>