mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
upgrading examples
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@128472 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
0a593798d6
commit
5459be6d9a
2 changed files with 38 additions and 33 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<!-- $Revision: 1.3 $ -->
|
||||
<!-- splitted from ./en/functions/strings.xml, last change in rev 1.2 -->
|
||||
<refentry id="function.strtr">
|
||||
<refnamediv>
|
||||
|
@ -39,7 +39,7 @@ $addr = strtr($addr, "
|
|||
</example>
|
||||
</para>
|
||||
<para>
|
||||
<function>strtr</function> can be called with only two
|
||||
<function>strtr</function> may be called with only two
|
||||
arguments. If called with two arguments it behaves in a new way:
|
||||
<parameter>from</parameter> then has to be an array that contains
|
||||
string -> string pairs that will be replaced in the source
|
||||
|
@ -47,18 +47,25 @@ $addr = strtr($addr, "
|
|||
longest possible match first and will *NOT* try to replace stuff
|
||||
that it has already worked on.
|
||||
</para>
|
||||
<para>
|
||||
Examples:
|
||||
<informalexample>
|
||||
<example>
|
||||
<title><function>strtr</function> example with two arguments</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
$trans = array("hello" => "hi", "hi" => "hello");
|
||||
echo strtr("hi all, I said hello", $trans) . "\n";
|
||||
<?php
|
||||
$trans = array("hello" => "hi", "hi" => "hello");
|
||||
echo strtr("hi all, I said hello", $trans);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
This will show: "hello all, I said hi",
|
||||
<para>
|
||||
This will show:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
hello all, I said hi
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
<note>
|
||||
<simpara>
|
||||
This optional <parameter>to</parameter> and
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- splitted from ./en/functions/strings.xml, last change in rev 1.142 -->
|
||||
<refentry id="function.wordwrap">
|
||||
<refnamediv>
|
||||
|
@ -20,14 +20,15 @@
|
|||
</methodsynopsis>
|
||||
<para>
|
||||
Returns a string with <parameter>str</parameter> wrapped
|
||||
at the column number specified by the (optional)
|
||||
at the column number specified by the optional
|
||||
<parameter>width</parameter> parameter. The line is broken
|
||||
using the (optional) <parameter>break</parameter> parameter.
|
||||
</para>
|
||||
<para>
|
||||
<function>wordwrap</function> will automatically wrap at column
|
||||
75 and break using '\n' (newline) if <parameter>width</parameter>
|
||||
or <parameter>break</parameter> are not given.
|
||||
75 and break using '<literal>\n</literal>' (newline) if
|
||||
<parameter>width</parameter> or <parameter>break</parameter>
|
||||
are not given.
|
||||
</para>
|
||||
<para>
|
||||
If the <parameter>cut</parameter> is set to 1, the string is
|
||||
|
@ -51,23 +52,20 @@ $newtext = wordwrap( $text, 20 );
|
|||
|
||||
echo "$newtext\n";
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</programlisting>
|
||||
<para>
|
||||
This example would display:
|
||||
</para>
|
||||
<para>
|
||||
<informalexample>
|
||||
<screen>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
The quick brown fox
|
||||
jumped over the
|
||||
The quick brown fox
|
||||
|
||||
jumped over the
|
||||
|
||||
lazy dog.
|
||||
]]>
|
||||
</screen>
|
||||
</informalexample>
|
||||
</para>
|
||||
</screen>
|
||||
</example>
|
||||
<para>
|
||||
<example>
|
||||
<title><function>wordwrap</function> example</title>
|
||||
|
@ -78,23 +76,23 @@ $newtext = wordwrap( $text, 8, "\n", 1);
|
|||
|
||||
echo "$newtext\n";
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</programlisting>
|
||||
</para>
|
||||
<para>
|
||||
This example would display:
|
||||
</para>
|
||||
<para>
|
||||
<informalexample>
|
||||
<screen>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
A very
|
||||
long
|
||||
wooooooo
|
||||
A very
|
||||
|
||||
long
|
||||
|
||||
wooooooo
|
||||
|
||||
ooooord.
|
||||
]]>
|
||||
</screen>
|
||||
</informalexample>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
See also <function>nl2br</function>.
|
||||
|
|
Loading…
Reference in a new issue