i think it would be possible using str_word_count
this would read all the words into an array and with long text
strings might slow the script
a better method would be to limit the total character to the first word gap after say 150 characters example below
// example string
$line["description"]="dfhdjdh dhdfgdg sgstsdg dsghdgdgd dsgdgdgd
dgdgdg dsgdgdfwd dgryhjrh rfir dhghdg shwfs dkdhsgs dhywyhuhe dhdhg
dhgdsgsgs sgsgsgsgs dghdgdgdgas dshgbdg dhdhdh shssh ahgagag shgsgsg agagaga";
// starting position of seach for space
$limit=150;
echo ($limit < strlen($line["description"]))
?substr($line["description"],0,strpos ($line["description"], " " ,$limit))."...":$line["description"];