コード例 #1
0
ファイル: string.php プロジェクト: m1ke/easy-site-utils
function html_words($html, $count)
{
    $html = strip_tags($html);
    $len = strlen($html);
    $html = substr_words($html, $count);
    if (strlen($html) < $len) {
        $html .= '&hellip;';
    }
    return $html;
}
コード例 #2
0
 function testSubstrWordsEndSep()
 {
     $sentence = 'The quick brown ';
     $four_words = substr_words($sentence, 4);
     $this->assertEquals($four_words, 'The quick brown');
 }