cvs: /phpdoc/functions regex.sgml
| From: | Torben Wilson | Date: | Mon, 15 Nov 1999 23:54:48 +0000 |
| Subject: | cvs: /phpdoc/functions regex.sgml | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-12584@lists.php.net to get a copy of this message | ||
cslawi Mon Nov 15 18:54:48 1999 EDT
Modified files:
/phpdoc/functions regex.sgml
Log:
Added another example to split().
Index: phpdoc/functions/regex.sgml
diff -u phpdoc/functions/regex.sgml:1.5 phpdoc/functions/regex.sgml:1.6
--- phpdoc/functions/regex.sgml:1.5 Mon Nov 15 18:43:14 1999
+++ phpdoc/functions/regex.sgml Mon Nov 15 18:54:47 1999
@@ -254,13 +254,30 @@
<para>
To get the first five fields from a line from
<filename>/etc/passwd</filename>:
- <example>
+ <example>
<title>split() example</title>
<programlisting>
$passwd_list = split( ":", $passwd_line, 5 );
-</programlisting></example></para>
+ </programlisting>
+ </example>
+ </para>
+
<para>
- Note that <parameter>pattern</parameter> is case-sensitive.</para>
+ To parse a date which may be delimited with slashes, dots, or
+ hyphens:
+ <example>
+ <title>split() example</title>
+ <programlisting>
+$date = "04/30/1973"; // Delimiters may be slash, dot, or hyphen
+list( $month, $day, $year ) = split( '[/.-]', $date );
+echo "Month: $month; Day: $day; Year: $year<br>\n";
+ </programlisting>
+ </example>
+ </para>
+
+ <para>
+ Note that <parameter>pattern</parameter> is case-sensitive.
+ </para>
<para>
Note that if you don't require the power of regular expressions,