note 36853 added to function.split
| From: | krahn at niehs dot nih dot gov | Date: | Fri, 24 Oct 2003 16:14:40 +0000 |
| Subject: | note 36853 added to function.split | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-59252@lists.php.net to get a copy of this message | ||
> strange things happen with split
> this didn't work
> $vontag $vonmonat were empty strings
...
> list ($vontag , $vonmonat) = split ('.' , $fromdate); // << bad
Split is acting exactly as it should; it splits on regular expressions.
A period is a regular expression pattern for a single character.
So, an actual period must be escaped with a backslash: '\.'
A period within brackets is not an any-character pattern, because it does
not make sense in that context.
Beware that regular expressions can be confusing becuase there
are a few different varieties of patterns.
----
Manual Page -- http://www.php.net/manual/en/function.split.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+36853
Delete -- http://master.php.net/manage/user-notes.php?action=delete+36853&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+36853&report=yes
Search -- http://master.php.net/manage/user-notes.php