CVS update: php3/doc/functions
| From: | sas | Date: | Sun, 20 Dec 1998 07:32:26 +0000 |
| Subject: | CVS update: php3/doc/functions | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-2904@lists.php.net to get a copy of this message | ||
Date: Sunday December 20, 1998 @ 2:32
Author: sas
Update of /repository/php3/doc/functions
In directory asf:/u/temp/cvs-serv8175/doc/functions
Modified Files:
strings.sgml
Log Message:
added str_replace
improved quotemeta
updated changelog
changed documentation for chr_replace
Index: php3/doc/functions/strings.sgml
diff -c php3/doc/functions/strings.sgml:1.49 php3/doc/functions/strings.sgml:1.50
*** php3/doc/functions/strings.sgml:1.49 Sat Dec 19 22:07:37 1998
--- php3/doc/functions/strings.sgml Sun Dec 20 02:32:23 1998
***************
*** 91,110 ****
<refentry id="function.chr-replace">
<refnamediv>
<refname>chr_replace</refname>
! <refpurpose>Find all occurrences of char in str and replace with repl</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcdef>string <function>chr_replace</function></funcdef>
! <paramdef>string <parameter>char</parameter></paramdef>
! <paramdef>string <parameter>repl</parameter></paramdef>
<paramdef>string <parameter>str</parameter></paramdef>
</funcsynopsis>
<para>
! Searches <parameter>str</parameter> for all occurrences of
<parameter>char</parameter>
! and replaces it with <parameter>repl</parameter>. Note that this function does
not do
! in-place replacement. It returns the new string leaving the original string untouched.
<example>
<title>chr_replace() example</title>
<programlisting>
--- 91,112 ----
<refentry id="function.chr-replace">
<refnamediv>
<refname>chr_replace</refname>
! <refpurpose>Find all occurrences of needle in haystack and replace it with
str</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcdef>string <function>chr_replace</function></funcdef>
! <paramdef>string <parameter>needle</parameter></paramdef>
<paramdef>string <parameter>str</parameter></paramdef>
+ <paramdef>string <parameter>haystack</parameter></paramdef>
</funcsynopsis>
<para>
! Searches <parameter>haystack</parameter> for all occurrences of
! <parameter>needle</parameter> and replaces it with
! <parameter>str</parameter>. Note that this function does not do
! in-place replacement. It returns the new string leaving the original
! string untouched.
<example>
<title>chr_replace() example</title>
<programlisting>
***************
*** 113,119 ****
--- 115,126 ----
This function is significantly faster than <function>ereg_replace</function> and
should be
used when a simple single character needs to be replaced with one or more others.
+
+ <para>
+ See also:
+ <function>str_replace</function>
+
</refsect1>
</refentry>
***************
*** 1361,1366 ****
--- 1368,1411 ----
<para>
See also <function>strtolower</function>
and <function>ucfirst</function>.
+
+ </refsect1>
+ </refentry>
+
+ <refentry id="function.str-replace">
+ <refnamediv>
+ <refname>str_replace</refname>
+ <refpurpose>Replaces all occurences of needle in haystack with str</refpurpose>
+ </refnamediv>
+ <refsect1>
+ <title>Description</title>
+ <funcsynopsis>
+ <funcdef>string <function>str_replace</function></funcdef>
+ <paramdef>string <parameter>needle</parameter></paramdef>
+ <paramdef>string <parameter>str</parameter></paramdef>
+ <paramdef>string <parameter>haystack</parameter></paramdef>
+ </funcsynopsis>
+
+ <para>
+ This function replaces all occurences of <parameter>needle</parameter>
+ in <parameter>haystack</parameter> with the given
+ <parameter>str</parameter>. If you don't need fancy replacing
+ rules, you should always use this function instead of
+ <function>ereg_replace</function>.
+ <para>
+
+ <example>
+ <title>str_replace() example</title>
+ <programlisting>
+ $bodytag = str_replace("%body%", "black", "<body
text=%body%>");
+ </programlisting>
+ </example>
+
+ <para>
+ This function is binary safe.
+
+ <para>
+ See also <function>ereg_replace</function>.
</refsect1>
</refentry>
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net