Moved command executions to their own programlisting, for improved readability. And added/moved titles around.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@334361 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Philip Olson 2014-07-23 03:45:40 +00:00
parent ae1355bad7
commit 8ecda077dc

View file

@ -142,19 +142,22 @@
&reftitle.examples;
<para>
<example xml:id="getopt.examples-1">
<title><function>getopt</function> example</title>
<title><function>getopt</function> example: The basics</title>
<programlisting role="php">
<![CDATA[
<?php
// Script example.php
$options = getopt("f:hp:");
var_dump($options);
?>
]]>
</programlisting>
<para>
Running the above script with <literal>php script.php -fvalue -h</literal>
will output:
</para>
<programlisting role="shell">
<![CDATA[
shell> php example.php -fvalue -h
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
array(2) {
@ -169,10 +172,11 @@ array(2) {
</para>
<para>
<example xml:id="getopt.examples-2">
<title><function>getopt</function> example#2</title>
<title><function>getopt</function> example: Introducing long options</title>
<programlisting role="php">
<![CDATA[
<?php
// Script example.php
$shortopts = "";
$shortopts .= "f:"; // Required value
$shortopts .= "v::"; // Optional value
@ -189,11 +193,12 @@ var_dump($options);
?>
]]>
</programlisting>
<para>
Running the above script with <literal>php script.php -f "value for f" -v
-a --required value --optional="optional value" --option</literal>
will output:
</para>
<programlisting role="shell">
<![CDATA[
shell> php example.php -f "value for f" -v -a --required value --optional="optional value" --option
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
array(6) {
@ -216,20 +221,22 @@ array(6) {
</para>
<para>
<example xml:id="getopt.examples-3">
<title><function>getopt</function> example#3</title>
<para>Passing multiple options as one</para>
<title><function>getopt</function> example: Passing multiple options as one</title>
<programlisting role="php">
<![CDATA[
<?php
// Script example.php
$options = getopt("abc");
var_dump($options);
?>
]]>
</programlisting>
<para>
Running the above script with <literal>php script.php -aaac</literal>
will output:
</para>
<programlisting role="shell">
<![CDATA[
shell> php example.php -aaac
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
array(2) {