mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
PHP examples syntax errors
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@200791 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
775387ca25
commit
86f52dd346
9 changed files with 26 additions and 25 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.41 $ -->
|
||||
<!-- $Revision: 1.42 $ -->
|
||||
<chapter id="language.constants">
|
||||
<title>Constants</title>
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
|||
// Valid constant names
|
||||
define("FOO", "something");
|
||||
define("FOO2", "something else");
|
||||
define("FOO_BAR", "something more")
|
||||
define("FOO_BAR", "something more");
|
||||
|
||||
// Invalid constant names
|
||||
define("2FOO", "something");
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.apc-delete">
|
||||
<refnamediv>
|
||||
<refname>apc_delete</refname>
|
||||
|
@ -47,7 +47,7 @@
|
|||
<?php
|
||||
$bar = 'BAR';
|
||||
apc_store('foo', $bar);
|
||||
apc_delete('foo'));
|
||||
apc_delete('foo');
|
||||
// this is obviously useless in this form
|
||||
?>
|
||||
]]>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.6 $ -->
|
||||
<!-- $Revision: 1.7 $ -->
|
||||
<!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.39 -->
|
||||
<refentry id="function.is-uploaded-file">
|
||||
<refnamediv>
|
||||
|
@ -67,7 +67,7 @@ if (is_uploaded_file($_FILES['userfile']['tmp_name'])) {
|
|||
<![CDATA[
|
||||
<?php
|
||||
/* Userland test for uploaded file. */
|
||||
function is_uploaded_file($filename)
|
||||
function is_uploaded_file_4_0_2($filename)
|
||||
{
|
||||
if (!$tmp_file = get_cfg_var('upload_tmp_dir')) {
|
||||
$tmp_file = dirname(tempnam('', ''));
|
||||
|
@ -79,7 +79,7 @@ function is_uploaded_file($filename)
|
|||
|
||||
/* This is how to use it, since you also don't have
|
||||
* move_uploaded_file() in these older versions: */
|
||||
if (is_uploaded_file($HTTP_POST_FILES['userfile'])) {
|
||||
if (is_uploaded_file_4_0_2($HTTP_POST_FILES['userfile'])) {
|
||||
copy($HTTP_POST_FILES['userfile'], "/place/to/put/uploaded/file");
|
||||
} else {
|
||||
echo "Possible file upload attack: filename '$HTTP_POST_FILES[userfile]'.";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<!-- $Revision: 1.3 $ -->
|
||||
<section id="pdo-mysql.constants">
|
||||
&reftitle.constants;
|
||||
&pdo.driver-constants;
|
||||
|
@ -21,12 +21,13 @@
|
|||
<programlisting role='php'>
|
||||
<![CDATA[
|
||||
<?php
|
||||
if ($db->getAttribute(PDO_ATTR_DRIVERNAME) == 'mysql')) {
|
||||
$stmt = $db->prepare('select * from foo',
|
||||
array(PDO_MYSQL_ATTR_USE_UNBUFFERED_QUERY => true));
|
||||
if ($db->getAttribute(PDO_ATTR_DRIVERNAME) == 'mysql') {
|
||||
$stmt = $db->prepare('select * from foo',
|
||||
array(PDO_MYSQL_ATTR_USE_UNBUFFERED_QUERY => true));
|
||||
} else {
|
||||
die("my application only works with mysql; I should use \$stmt->fetchAll() instead");
|
||||
die("my application only works with mysql; I should use \$stmt->fetchAll() instead");
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<!-- $Revision: 1.10 $ -->
|
||||
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.61 -->
|
||||
<refentry id='function.pg-escape-bytea'>
|
||||
<refnamediv>
|
||||
|
@ -79,7 +79,7 @@
|
|||
$escaped = pg_escape_bytea($data);
|
||||
|
||||
// Insert it into the database
|
||||
pg_query("INSERT INTO gallery (name, data) VALUES ('Pine trees', '{$escaped}')";
|
||||
pg_query("INSERT INTO gallery (name, data) VALUES ('Pine trees', '{$escaped}')");
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.6 $ -->
|
||||
<!-- $Revision: 1.7 $ -->
|
||||
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.61 -->
|
||||
<refentry id='function.pg-escape-string'>
|
||||
<refnamediv>
|
||||
|
@ -71,7 +71,7 @@
|
|||
$escaped = pg_escape_string($data);
|
||||
|
||||
// Insert it into the database
|
||||
pg_query("INSERT INTO correspondence (name, data) VALUES ('My letter', '{$escaped}')";
|
||||
pg_query("INSERT INTO correspondence (name, data) VALUES ('My letter', '{$escaped}')");
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<!-- $Revision: 1.3 $ -->
|
||||
<!-- Generated by xml_proto.php v2.2. Found in /scripts directory of phpdoc. -->
|
||||
<refentry id="runkit.sandbox-parent">
|
||||
<refnamediv>
|
||||
|
@ -39,6 +39,7 @@
|
|||
<?php
|
||||
$sandbox = new Runkit_Sandbox();
|
||||
$sandbox['parent_access'] = true;
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.16 $ -->
|
||||
<!-- $Revision: 1.17 $ -->
|
||||
<!-- Purpose: database.abstract -->
|
||||
<!-- Membership: pecl -->
|
||||
<!-- State: experimental -->
|
||||
|
@ -528,7 +528,7 @@ sdoxml:propertyType="company:EmployeeType"/> </xsd:complexType>
|
|||
<![CDATA[
|
||||
<?php
|
||||
foreach ($company as $name => $value) {
|
||||
...
|
||||
// ...
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
|
@ -556,7 +556,7 @@ sdoxml:propertyType="company:EmployeeType"/> </xsd:complexType>
|
|||
<![CDATA[
|
||||
<?php
|
||||
foreach ($company->departments as $department) {
|
||||
...
|
||||
// ...
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
|
@ -922,7 +922,7 @@ sdoxml:propertyType="company:EmployeeType"/> </xsd:complexType>
|
|||
<![CDATA[
|
||||
<?php
|
||||
foreach ($letter->getSequence() as $value) {
|
||||
...
|
||||
// ...
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
|
@ -1015,7 +1015,7 @@ sdoxml:propertyType="company:EmployeeType"/> </xsd:complexType>
|
|||
<programlisting role="php" id="sdo.examples.seqremove">
|
||||
<![CDATA[
|
||||
<?php
|
||||
if (isset($letter_seq[0]) {
|
||||
if (isset($letter_seq[0])) {
|
||||
unset($letter_seq[0]);
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.11 $ -->
|
||||
<!-- $Revision: 1.12 $ -->
|
||||
<!-- Purpose: xml -->
|
||||
<!-- Membership: pecl -->
|
||||
<!-- State: experimental -->
|
||||
|
@ -738,8 +738,7 @@ $emp1->name = "Fred";
|
|||
$emp1->manager = FALSE;
|
||||
$dept2 = $do->createDataObject("departments");
|
||||
$emp2 = $dept2->createDataObject("employees");
|
||||
$emp2->n
|
||||
ame = "Neil";
|
||||
$emp2->name = "Neil";
|
||||
$emp2->manager = TRUE;
|
||||
print($xmldas->saveDataObjectToString($do, "companyNS", "CompanyType"));
|
||||
var_dump($do);
|
||||
|
|
Loading…
Reference in a new issue