mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Cleaned up the examples a bit
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@299622 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
4ff73f7555
commit
daf137f592
1 changed files with 27 additions and 32 deletions
|
@ -240,11 +240,11 @@
|
|||
The &cli.sapi; does <emphasis role="strong">not</emphasis> change the
|
||||
current directory to the directory of the executed script!
|
||||
</para>
|
||||
<informalexample>
|
||||
<para>
|
||||
<example>
|
||||
<title>
|
||||
Example showing the difference to the <acronym>CGI</acronym>
|
||||
<acronym>SAPI</acronym>:
|
||||
</para>
|
||||
</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
@ -284,7 +284,7 @@ $ php -f another_directory/test.php
|
|||
<para>
|
||||
This allows greater flexibility when writing shell tools in PHP.
|
||||
</para>
|
||||
</informalexample>
|
||||
</example>
|
||||
<note>
|
||||
<para>
|
||||
The <acronym>CGI</acronym> <acronym>SAPI</acronym> supports this
|
||||
|
@ -457,10 +457,7 @@ $ php -c /custom/directory/custom-file.ini my_script.php
|
|||
]]>
|
||||
</screen>
|
||||
</para>
|
||||
<para><informalexample>
|
||||
<para>
|
||||
Examples (lines are wrapped for layout reasons):
|
||||
</para>
|
||||
<para><example>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
# Omitting the value part will set the given configuration directive to "1"
|
||||
|
@ -483,7 +480,7 @@ $ php
|
|||
string(15) "doesntmakesense"
|
||||
]]>
|
||||
</screen>
|
||||
</informalexample></para>
|
||||
</example></para>
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
|
@ -564,11 +561,8 @@ string(15) "doesntmakesense"
|
|||
<entry>-m</entry>
|
||||
<entry>--modules</entry>
|
||||
<entry>
|
||||
<para><informalexample>
|
||||
<para>
|
||||
Using this option, PHP prints out the built in (and loaded) PHP and
|
||||
Zend modules:
|
||||
</para>
|
||||
<para><example>
|
||||
<title>Printing built in (and loaded) PHP and Zend modules</title>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
$ php -m
|
||||
|
@ -587,7 +581,7 @@ ctype
|
|||
[Zend Modules]
|
||||
]]>
|
||||
</screen>
|
||||
</informalexample></para>
|
||||
</example></para>
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
|
@ -607,10 +601,8 @@ ctype
|
|||
to not collide with command line variable substitution done by the
|
||||
shell.
|
||||
</para>
|
||||
<informalexample>
|
||||
<para>
|
||||
Example showing a parser error
|
||||
</para>
|
||||
<example>
|
||||
<title>Getting a syntax error when using double quotes</title>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
$ php -r "$foo = get_defined_constants();"
|
||||
|
@ -619,7 +611,7 @@ PHP Parse error: syntax error, unexpected '=' in Command line code on line 1
|
|||
Parse error: syntax error, unexpected '=' in Command line code on line 1
|
||||
]]>
|
||||
</screen>
|
||||
</informalexample>
|
||||
</example>
|
||||
<para>
|
||||
The problem here is that the sh/bash performs variable substitution
|
||||
even when using double quotes <literal>"</literal>. Since the
|
||||
|
@ -633,11 +625,16 @@ Parse error: syntax error, unexpected '=' in Command line code on line 1
|
|||
$ php -r " = get_defined_constants();"
|
||||
]]>
|
||||
</screen>
|
||||
<para>
|
||||
The correct way would be to use single quotes <literal>'</literal>.
|
||||
Variables in single-quoted strings are not expanded
|
||||
by sh/bash.
|
||||
</para>
|
||||
</informalexample>
|
||||
|
||||
<para>
|
||||
The correct way would be to use single quotes <literal>'</literal>.
|
||||
Variables in single-quoted strings are not expanded
|
||||
by sh/bash.
|
||||
</para>
|
||||
<example>
|
||||
<title>Using single quotes to prevent the shell's variable
|
||||
substitution</title>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
$ php -r '$foo = get_defined_constants(); var_dump($foo);'
|
||||
|
@ -654,7 +651,7 @@ array(370) {
|
|||
[...]
|
||||
]]>
|
||||
</screen>
|
||||
</informalexample>
|
||||
</example>
|
||||
<para>
|
||||
If you are using a shell different from sh/bash, you might experience
|
||||
further issues. Feel free to open a bug report at
|
||||
|
@ -762,11 +759,9 @@ Total Lines: 37328
|
|||
<entry>-v</entry>
|
||||
<entry>--version</entry>
|
||||
<entry>
|
||||
<para><informalexample>
|
||||
<para>
|
||||
Writes the PHP, PHP <acronym>SAPI</acronym>, and Zend version to
|
||||
standard output, e.g.
|
||||
</para>
|
||||
<para><example>
|
||||
<title>Using <option>-v</option> to get the <acronym>SAPI</acronym>
|
||||
name and the version of PHP and Zend</title>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
$ php -v
|
||||
|
@ -775,7 +770,7 @@ Copyright (c) 1997-2009 The PHP Group
|
|||
Zend Engine v2.3.0, Copyright (c) 1998-2009 Zend Technologies
|
||||
]]>
|
||||
</screen>
|
||||
</informalexample></para>
|
||||
</example></para>
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
|
|
Loading…
Reference in a new issue