mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-15 16:38:54 +00:00
Add PHP tags to <programlisting>
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@301112 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
07821cd88c
commit
f453f7036c
22 changed files with 71 additions and 34 deletions
|
@ -25,7 +25,7 @@ $c = 7E-10;
|
|||
</para>
|
||||
|
||||
<informalexample>
|
||||
<programlisting role="php">
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
LNUM [0-9]+
|
||||
DNUM ([0-9]*[\.]{LNUM}) | ({LNUM}[\.][0-9]*)
|
||||
|
|
|
@ -13,9 +13,11 @@
|
|||
</para>
|
||||
<para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
apd_set_pprof_trace();
|
||||
]]>
|
||||
<![CDATA[
|
||||
<?php
|
||||
apd_set_pprof_trace();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</para>
|
||||
<para>
|
||||
|
|
|
@ -42,12 +42,14 @@
|
|||
<title><function>fbsql_list_dbs</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = fbsql_connect('localhost', 'myname', 'secret');
|
||||
$db_list = fbsql_list_dbs($link);
|
||||
|
||||
while ($row = fbsql_fetch_object($db_list)) {
|
||||
echo $row->Database . "\n";
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs.similar;
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
behavior similar to the Sybase database, add to your
|
||||
&php.ini; the following directive:
|
||||
<informalexample>
|
||||
<programlisting role="php">
|
||||
<programlisting role="php.ini">
|
||||
<![CDATA[
|
||||
magic_quotes_sybase = On
|
||||
]]>
|
||||
|
|
|
@ -49,7 +49,9 @@
|
|||
<title><function>ifx_errormsg</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
printf("%s\n<br>", ifx_errormsg(-201));
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
|
|
@ -68,13 +68,11 @@
|
|||
<title><function>grapheme_strrpos</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
< ?php
|
||||
|
||||
<?php
|
||||
$char_a_ring_nfd = "a\xCC\x8A"; // 'LATIN SMALL LETTER A WITH RING ABOVE' (U+00E5) normalization form "D"
|
||||
$char_o_diaeresis_nfd = "o\xCC\x88"; // 'LATIN SMALL LETTER O WITH DIAERESIS' (U+00F6) normalization form "D"
|
||||
|
||||
print grapheme_strrpos( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd);
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
|
|
|
@ -208,19 +208,20 @@
|
|||
<title>Produce a list of all organizational units of an organization</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// $ds is a valid link identifier for a directory server
|
||||
|
||||
$basedn = "o=My Company, c=US";
|
||||
$justthese = array("ou");
|
||||
|
||||
$sr=ldap_list($ds, $basedn, "ou=*", $justthese);
|
||||
$sr = ldap_list($ds, $basedn, "ou=*", $justthese);
|
||||
|
||||
$info = ldap_get_entries($ds, $sr);
|
||||
|
||||
for ($i=0; $i<$info["count"]; $i++) {
|
||||
echo $info[$i]["ou"][0] ;
|
||||
for ($i=0; $i < $info["count"]; $i++) {
|
||||
echo $info[$i]["ou"][0];
|
||||
}
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
<para>
|
||||
<example>
|
||||
<title><parameter>convmap</parameter> example</title>
|
||||
<programlisting role="php">
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
$convmap = array (
|
||||
int start_code1, int end_code1, int offset1, int mask1,
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
<para>
|
||||
<example>
|
||||
<title><parameter>convmap</parameter> example</title>
|
||||
<programlisting role="php">
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
$convmap = array (
|
||||
int start_code1, int end_code1, int offset1, int mask1,
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
<title>
|
||||
Disable HTTP input conversion in &php.ini;
|
||||
</title>
|
||||
<programlisting role="php">
|
||||
<programlisting role="php.ini">
|
||||
<![CDATA[
|
||||
;; Disable HTTP Input conversion
|
||||
mbstring.http_input = pass
|
||||
|
|
|
@ -87,13 +87,17 @@ $db->command(array("logout" => 1));
|
|||
Returns database response. If the login was successful, it will return
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
array("ok" => 1)
|
||||
<?php
|
||||
array("ok" => 1);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
If something went wrong, it will return
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
array("ok" => 0, "errmsg" => "auth fails")
|
||||
<?php
|
||||
array("ok" => 0, "errmsg" => "auth fails");
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
("auth fails" could be another message, depending on database version and what
|
||||
|
|
|
@ -36,16 +36,20 @@
|
|||
For example, the files document is something like:
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
array("_id" => 123456789, "filename" => "foo.txt", "chunkSize" => 3, "length" => 12)
|
||||
<?php
|
||||
array("_id" => 123456789, "filename" => "foo.txt", "chunkSize" => 3, "length" => 12);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
and the chunks documents look like:
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
array("files_id" => 123456789, "n" => 0, "data" => new MongoBinData("abc"));
|
||||
array("files_id" => 123456789, "n" => 1, "data" => new MongoBinData("def"));
|
||||
array("files_id" => 123456789, "n" => 2, "data" => new MongoBinData("ghi"));
|
||||
array("files_id" => 123456789, "n" => 3, "data" => new MongoBinData("jkl"));
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
Of course, the default chunk size is thousands of bytes, but that makes an unweildy example.
|
||||
|
|
|
@ -17,15 +17,21 @@
|
|||
<literal>mysqli</literal>:
|
||||
</para>
|
||||
|
||||
<programlisting role="php">$host="p:localhost";
|
||||
$port=3306;
|
||||
$socket="/tmp/mysql.sock";
|
||||
$user="root";
|
||||
$password="password";
|
||||
$dbname="test";
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$host = "p:localhost";
|
||||
$port = 3306;
|
||||
$socket = "/tmp/mysql.sock";
|
||||
$user = "root";
|
||||
$password = "password";
|
||||
$dbname = "test";
|
||||
|
||||
$conn = new mysqli($host, $user, $password, $dbname, $port, $socket)
|
||||
or die ('Could not connect to the database server' . mysqli_connect_error());</programlisting>
|
||||
or die('Could not connect to the database server' . mysqli_connect_error());
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
|
||||
</chapter>
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
|
|
@ -793,9 +793,11 @@ print '</table>';
|
|||
<informalexample>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
foreach ($myarray as $key => $value) {
|
||||
oci_bind_by_name($stid, $key, $value);
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
|
@ -807,9 +809,11 @@ foreach ($myarray as $key => $value) {
|
|||
<informalexample>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
foreach ($myarray as $key => $value) {
|
||||
oci_bind_by_name($stid, $key, $myarray[$key]);
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
|
|
|
@ -129,11 +129,13 @@
|
|||
<title>Displaying the Oracle error message after a connection error</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$conn = oci_connect("hr", "welcome", "localhost/XE");
|
||||
if (!$conn) {
|
||||
$e = oci_error(); // For oci_connect errors do not pass a handle
|
||||
trigger_error(htmlentities($e['message']), E_USER_ERROR);
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
@ -143,11 +145,13 @@ if (!$conn) {
|
|||
<title>Displaying the Oracle error message after a parsing error</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$stid = oci_parse($conn, "select ' from dual"); // note mismatched quote
|
||||
if (!$stid) {
|
||||
$e = oci_error($conn); // For oci_parse errors pass the connection handle
|
||||
trigger_error(htmlentities($e['message']), E_USER_ERROR);
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
@ -158,6 +162,7 @@ if (!$stid) {
|
|||
and the position of the problem of an execution error</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$stid = oci_parse($conn, "select does_not_exist from dual");
|
||||
$r = oci_execute($stid);
|
||||
if (!$r) {
|
||||
|
@ -168,6 +173,7 @@ if (!$r) {
|
|||
printf("\n%".($e['offset']+1)."s", "^");
|
||||
print "\n</pre>\n";
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
|
|
@ -106,6 +106,7 @@ if (!r) {
|
|||
<title>Rolling back to a <literal>SAVEPOINT</literal> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$stid = oci_parse($conn, 'UPDATE mytab SET id = 1111');
|
||||
oci_execute($stid, OCI_NO_AUTO_COMMIT);
|
||||
|
||||
|
@ -121,6 +122,7 @@ $stid = oci_parse($conn, 'ROLLBACK TO SAVEPOINT mysavepoint');
|
|||
oci_execute($stid, OCI_NO_AUTO_COMMIT);
|
||||
|
||||
oci_commit($conn); // mytab now has id of 1111
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
|
|
@ -214,7 +214,7 @@ class ConvertedStockQuote {
|
|||
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
<?php
|
||||
/**
|
||||
* The currency exchange rate service to use.
|
||||
*
|
||||
|
@ -776,8 +776,10 @@ location="http://localhost/ConvertedStockQuote/ConvertedStockQuote.php"/>
|
|||
<para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$quote = $remote_service->getQuote('IBM','USD');
|
||||
]]>
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
|
@ -787,13 +789,13 @@ location="http://localhost/ConvertedStockQuote/ConvertedStockQuote.php"/>
|
|||
</para>
|
||||
|
||||
<para>
|
||||
<programlisting role="php">
|
||||
<programlisting role="xml">
|
||||
<![CDATA[
|
||||
<getQuote>
|
||||
<ticker>IBM</ticker>
|
||||
<currency>USD</currency>
|
||||
</getQuote>
|
||||
]]>
|
||||
]]>
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
|
|
|
@ -23,11 +23,11 @@
|
|||
The <constant>E_WARNING</constant> messages generated by the socket
|
||||
extension are in English though the retrieved error message will appear
|
||||
depending on the current locale (<constant>LC_MESSAGES</constant>):
|
||||
<programlisting role="php">
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Warning - socket_bind() unable to bind address [98]: Die Adresse wird bereits verwendet
|
||||
]]>
|
||||
</programlisting>
|
||||
</screen>
|
||||
</para>
|
||||
</note>
|
||||
</chapter>
|
||||
|
|
|
@ -82,7 +82,9 @@ SetEnv TMP c:/temp
|
|||
<informalexample>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
putenv('TMP=C:/temp');
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
|
|
|
@ -146,6 +146,7 @@
|
|||
<title>Authentication configuration for <filename>wincache.php</filename></title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
/**
|
||||
* ======================== CONFIGURATION SETTINGS ==============================
|
||||
* If you do not want to use authentication for this page, set USE_AUTHENTICATION to 0.
|
||||
|
@ -172,6 +173,7 @@ $user_allowed = array('DOMAIN\user1', 'DOMAIN\user2', 'DOMAIN\user3');
|
|||
/* $user_allowed = array('all'); */
|
||||
|
||||
/** ===================== END OF CONFIGURATION SETTINGS ========================== */
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
@ -201,7 +203,7 @@ $user_allowed = array('DOMAIN\user1', 'DOMAIN\user2', 'DOMAIN\user3');
|
|||
<link linkend="ini.session.save-path">session.save_path</link> directive.
|
||||
<example>
|
||||
<title>Enabling WinCache session handler</title>
|
||||
<programlisting role="php">
|
||||
<programlisting role="php.ini">
|
||||
<![CDATA[
|
||||
session.save_handler = wincache
|
||||
session.save_path = C:\inetpub\temp\session\
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
SAX handlers should be a two dimensional array
|
||||
with the format (all top level elements are optional):
|
||||
<informalexample>
|
||||
<programlisting role="php">
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
array(
|
||||
[document] =>
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
Scheme handlers should be an array with the
|
||||
format (all elements are optional):
|
||||
<informalexample>
|
||||
<programlisting role="php">
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
array(
|
||||
[get_all] => get all handler,
|
||||
|
|
Loading…
Reference in a new issue