note 84419 added to function.split
| From: | pascalaschwandenNOSPAM at gmail dot com | Date: | Sun, 13 Jul 2008 19:12:17 +0000 |
| Subject: | note 84419 added to function.split | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-141456@lists.php.net to get a copy of this message | ||
The following code will mimick the explode functionality: explode( " ", $s ); The
difference, of course, is that the split method takes a regular expression instead of a string.
$s = "Split this sentence by spaces";
$words = split("[ ]+", $s);
print_r($words);
Output:
Array
(
[0] => Split
[1] => this
[2] => sentence
[3] => by
[4] => spaces
)
http://www.codesplunk.com/nr/questions/php12.html
----
Server IP: 208.69.120.35
Probable Submitter: 64.81.242.62
----
Manual Page -- http://www.php.net/manual/en/function.split.php
Edit -- https://master.php.net/note/edit/84419
Del: integrated -- https://master.php.net/note/delete/84419/integrated
Del: useless -- https://master.php.net/note/delete/84419/useless
Del: bad code -- https://master.php.net/note/delete/84419/bad+code
Del: spam -- https://master.php.net/note/delete/84419/spam
Del: non-english -- https://master.php.net/note/delete/84419/non-english
Del: in docs -- https://master.php.net/note/delete/84419/in+docs
Del: other reasons-- https://master.php.net/note/delete/84419
Reject -- https://master.php.net/note/reject/84419
Search -- https://master.php.net/manage/user-notes.php