note 104615 deleted from function.substr by danbrown
| From: | danbrown@php.net | Date: | Sun, 26 Jun 2011 15:59:02 +0000 |
| Subject: | note 104615 deleted from function.substr by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-180963@lists.php.net to get a copy of this message | ||
Note Submitter: alex dot audu at garlandnetworx dot com
----
I used the following to return the first word in a string of words up to the first occurence of a
delimiter character.
$firstWord =
substr($wString, 0, -strrpos($wString, $delimiter));
For example: for
$wString = "This is great";
$delimiter = " ";
Then $firstWord = "This"
Cheers.
Alex.