note 104613 added to function.substr
| From: | alex dot audu at garlandnetworx dot com | Date: | Sun, 26 Jun 2011 05:31:47 +0000 |
| Subject: | note 104613 added to function.substr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-180954@lists.php.net to get a copy of this message | ||
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, -strlen($wString, $delimiter);
For example: for
$wString = "This is great";
$delimiter = " ";
Then $firstWord = "This"
Cheers.
Alex.
----
Server IP: 69.147.83.197
Probable Submitter: 71.170.112.136
----
Manual Page -- http://www.php.net/manual/en/function.substr.php
Edit -- https://master.php.net/note/edit/104613
Del: integrated -- https://master.php.net/note/delete/104613/integrated
Del: useless -- https://master.php.net/note/delete/104613/useless
Del: bad code -- https://master.php.net/note/delete/104613/bad+code
Del: spam -- https://master.php.net/note/delete/104613/spam
Del: non-english -- https://master.php.net/note/delete/104613/non-english
Del: in docs -- https://master.php.net/note/delete/104613/in+docs
Del: other reasons-- https://master.php.net/note/delete/104613
Reject -- https://master.php.net/note/reject/104613
Search -- https://master.php.net/manage/user-notes.php