note 18858 added to function.substr

From: Date: Thu, 07 Feb 2002 14:16:02 +0000
Subject: note 18858 added to function.substr
Groups: php.notes 
Request: Send a blank email to php-notes+get-26351@lists.php.net to get a copy of this message
PHP really needs a substr_index function to return x number of words from a string. One workaroung is by using mysql: select SUBSTRING_INDEX(field, ' ', 50) FROM tablename The " " is what you wish to index, this this case a space. "50" is the amount of words you wish to return -- http://www.php.net/manual/en/function.substr.php http://master.php.net/manage/user-notes.php?action=edit+18858 http://master.php.net/manage/user-notes.php?action=delete+18858 http://master.php.net/manage/user-notes.php?action=reject+18858

« previous php.notes (#26351) next »