mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Switch to new doc style (tm)
# anyone for a make test ? git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@236869 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
0db4f1d2a5
commit
8e97792cf0
3 changed files with 314 additions and 199 deletions
|
@ -1,80 +1,117 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.10 $ -->
|
||||
<!-- splitted from ./en/functions/var.xml, last change in rev 1.34 -->
|
||||
<refentry id="function.import-request-variables">
|
||||
<refnamediv>
|
||||
<refname>import_request_variables</refname>
|
||||
<refpurpose>Import GET/POST/Cookie variables into the global scope</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>import_request_variables</methodname>
|
||||
<methodparam><type>string</type><parameter>types</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>prefix</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<simpara>
|
||||
Imports GET/POST/Cookie variables into the global scope. It is
|
||||
useful if you disabled
|
||||
<link linkend="ini.register-globals">register_globals</link>,
|
||||
but would like to see some variables in the global scope.
|
||||
</simpara>
|
||||
<simpara>
|
||||
Using the <parameter>types</parameter> parameter, you can
|
||||
specify which request variables to import. You can use
|
||||
'G', 'P' and 'C' characters respectively for GET, POST and
|
||||
Cookie. These characters are not case sensitive, so you
|
||||
can also use any combination of 'g', 'p' and 'c'. POST
|
||||
includes the POST uploaded file information. Note that the
|
||||
order of the letters matters, as when using "gp", the POST
|
||||
variables will overwrite GET variables with the same
|
||||
name. Any other letters than GPC are discarded.
|
||||
</simpara>
|
||||
<simpara>
|
||||
The <parameter>prefix</parameter> parameter is used as a variable
|
||||
name prefix, prepended before all variable's name imported into the
|
||||
global scope. So if you have a GET value named "userid", and provide
|
||||
a prefix "pref_", then you'll get a global variable named
|
||||
$pref_userid.
|
||||
</simpara>
|
||||
<simpara>
|
||||
If you're interested in importing other variables
|
||||
into the global scope, such as SERVER, consider using
|
||||
<function>extract</function>.
|
||||
</simpara>
|
||||
<note>
|
||||
<para>
|
||||
Although the <parameter>prefix</parameter> parameter is
|
||||
optional, you will get an
|
||||
<link linkend="internal.e-notice">E_NOTICE</link> level error if
|
||||
you specify no prefix, or specify an empty string as a
|
||||
prefix. This is a possible security hazard. Notice
|
||||
level errors are not displayed using the default
|
||||
<link linkend="ini.error-reporting">error reporting</link>
|
||||
level.
|
||||
</para>
|
||||
</note>
|
||||
<informalexample>
|
||||
<programlisting role="php">
|
||||
<!-- $Revision: 1.11 $ -->
|
||||
<refentry id="function.import-request-variables">
|
||||
<refnamediv>
|
||||
<refname>import_request_variables</refname>
|
||||
<refpurpose>Import GET/POST/Cookie variables into the global scope</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>import_request_variables</methodname>
|
||||
<methodparam><type>string</type><parameter>types</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>prefix</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Imports GET/POST/Cookie variables into the global scope. It is useful if
|
||||
you disabled <link linkend="ini.register-globals">register_globals</link>,
|
||||
but would like to see some variables in the global scope.
|
||||
</para>
|
||||
<para>
|
||||
If you're interested in importing other variables into the global scope,
|
||||
such as SERVER, consider using <function>extract</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>types</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Using the <parameter>types</parameter> parameter, you can specify
|
||||
which request variables to import. You can use 'G', 'P' and 'C'
|
||||
characters respectively for GET, POST and Cookie. These characters are
|
||||
not case sensitive, so you can also use any combination of 'g', 'p'
|
||||
and 'c'. POST includes the POST uploaded file information.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
Note that the order of the letters matters, as when using "gp", the
|
||||
POST variables will overwrite GET variables with the same name. Any
|
||||
other letters than GPC are discarded.
|
||||
</para>
|
||||
</note>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>prefix</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Variable name prefix, prepended before all variable's name imported
|
||||
into the global scope. So if you have a GET value named "userid", and
|
||||
provide a prefix "pref_", then you'll get a global variable named
|
||||
<varname>$pref_userid</varname>.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
Although the <parameter>prefix</parameter> parameter is optional, you
|
||||
will get an <link linkend="internal.e-notice">E_NOTICE</link> level
|
||||
error if you specify no prefix, or specify an empty string as a
|
||||
prefix. This is a possible security hazard. Notice level errors are
|
||||
not displayed using the default <link
|
||||
linkend="ini.error-reporting">error reporting</link> level.
|
||||
</para>
|
||||
</note>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
&return.success;
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>import_request_variables</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// This will import GET and POST vars
|
||||
// with an "rvar_" prefix
|
||||
import_request_variables("gP", "rvar_");
|
||||
import_request_variables("gp", "rvar_");
|
||||
|
||||
echo $rvar_foo;
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
<simpara>
|
||||
See also <link linkend="reserved.variables.request">$_REQUEST</link>,
|
||||
<link linkend="ini.register-globals">register_globals</link>,
|
||||
<link linkend="language.variables.predefined">Predefined Variables</link>,
|
||||
and <function>extract</function>.
|
||||
</simpara>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><link linkend="reserved.variables.request">$_REQUEST</link></member>
|
||||
<member><link linkend="ini.register-globals">register_globals</link></member>
|
||||
<member><link linkend="language.variables.predefined">Predefined Variables</link></member>
|
||||
<member><function>extract</function></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,51 +1,85 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.10 $ -->
|
||||
<!-- splitted from ./en/functions/var.xml, last change in rev 1.87 -->
|
||||
<refentry id="function.is-callable">
|
||||
<refnamediv>
|
||||
<refname>is_callable</refname>
|
||||
<refpurpose>
|
||||
Verify that the contents of a variable can be called as a function
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>is_callable</methodname>
|
||||
<methodparam><type>mixed</type><parameter>var</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>bool</type><parameter>syntax_only</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter role="reference">callable_name</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Verify that the contents of a variable can be called as a function.
|
||||
This can check that a simple variable contains the name of a valid
|
||||
function, or that an array contains a properly encoded object and
|
||||
function name.
|
||||
</para>
|
||||
<para>
|
||||
The <parameter>var</parameter> parameter can be either the name of a function stored in
|
||||
a string variable, or an object and the name of a method within the
|
||||
object, like this:
|
||||
<screen>array($SomeObject, 'MethodName')</screen>
|
||||
</para>
|
||||
<para>
|
||||
If the <parameter>syntax_only</parameter> argument is &true; the
|
||||
function only verifies that <parameter>var</parameter> might be a
|
||||
function or method. It will only reject simple variables that are
|
||||
not strings, or an array that does not have a valid structure to be
|
||||
used as a callback. The valid ones are supposed to have only 2
|
||||
entries, the first of which is an object or a string, and the
|
||||
second a string.
|
||||
</para>
|
||||
<para>
|
||||
The <parameter>callable_name</parameter> argument receives the
|
||||
"callable name". In the example below it's
|
||||
"someClass:someMethod". Note, however, that despite the
|
||||
implication that someClass::SomeMethod() is a callable static
|
||||
method, this is not the case.
|
||||
</para>
|
||||
<informalexample>
|
||||
<programlisting role="php">
|
||||
<!-- $Revision: 1.11 $ -->
|
||||
<refentry id="function.is-callable">
|
||||
<refnamediv>
|
||||
<refname>is_callable</refname>
|
||||
<refpurpose>
|
||||
Verify that the contents of a variable can be called as a function
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>is_callable</methodname>
|
||||
<methodparam><type>mixed</type><parameter>var</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>bool</type><parameter>syntax_only</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter role="reference">callable_name</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Verify that the contents of a variable can be called as a function.
|
||||
This can check that a simple variable contains the name of a valid
|
||||
function, or that an array contains a properly encoded object and
|
||||
function name.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>var</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Can be either the name of a function stored in a string variable, or
|
||||
an object and the name of a method within the object, like this:
|
||||
<screen>array($SomeObject, 'MethodName')</screen>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>syntax_only</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
If set to &true; the function only verifies that
|
||||
<parameter>var</parameter> might be a function or method. It will only
|
||||
reject simple variables that are not strings, or an array that does
|
||||
not have a valid structure to be used as a callback. The valid ones
|
||||
are supposed to have only 2 entries, the first of which is an object
|
||||
or a string, and the second a string.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>callable_name</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Receives the "callable name". In the example below it is
|
||||
"someClass:someMethod". Note, however, that despite the implication
|
||||
that someClass::SomeMethod() is a callable static method, this is not
|
||||
the case.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns &true; if <parameter>var</parameter> is callable, &false;
|
||||
otherwise.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>is_callable</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// How to check a variable to see if it can be called
|
||||
|
@ -87,14 +121,22 @@ echo $callable_name, "\n"; // someClass:someMethod
|
|||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
<para>
|
||||
See also <function>function_exists</function> and
|
||||
<function>method_exists</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>function_exists</function></member>
|
||||
<member><function>method_exists</function></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,70 +1,99 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.7 $ -->
|
||||
<!-- splitted from ./en/functions/var.xml, last change in rev 1.2 -->
|
||||
<refentry id="function.settype">
|
||||
<refnamediv>
|
||||
<refname>settype</refname>
|
||||
<refpurpose>Set the type of a variable</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>settype</methodname>
|
||||
<methodparam><type>mixed</type><parameter role="reference">var</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>type</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Set the type of variable <parameter>var</parameter> to
|
||||
<parameter>type</parameter>.
|
||||
</para>
|
||||
<para>
|
||||
Possibles values of <parameter>type</parameter> are:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara>
|
||||
"boolean" (or, since PHP 4.2.0, "bool")
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
"integer" (or, since PHP 4.2.0, "int")
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
"float" (only possible since PHP 4.2.0, for older versions use the
|
||||
deprecated variant "double")
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
"string"
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
"array"
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
"object"
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
"null" (since PHP 4.2.0)
|
||||
</simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
&return.success;
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title><function>settype</function> example</title>
|
||||
<programlisting role="php">
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<refentry id="function.settype">
|
||||
<refnamediv>
|
||||
<refname>settype</refname>
|
||||
<refpurpose>Set the type of a variable</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>settype</methodname>
|
||||
<methodparam><type>mixed</type><parameter role="reference">var</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>type</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Set the type of variable <parameter>var</parameter> to
|
||||
<parameter>type</parameter>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>var</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The variable being converted.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>type</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Possibles values of <parameter>type</parameter> are:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara>
|
||||
"boolean" (or, since PHP 4.2.0, "bool")
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
"integer" (or, since PHP 4.2.0, "int")
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
"float" (only possible since PHP 4.2.0, for older versions use the
|
||||
deprecated variant "double")
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
"string"
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
"array"
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
"object"
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
"null" (since PHP 4.2.0)
|
||||
</simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
&return.success;
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>settype</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$foo = "5bar"; // string
|
||||
|
@ -74,16 +103,23 @@ settype($foo, "integer"); // $foo is now 5 (integer)
|
|||
settype($bar, "string"); // $bar is now "1" (string)
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
See also <function>gettype</function>,
|
||||
<link linkend="language.types.typecasting">type-casting</link> and
|
||||
<link linkend="language.types.type-juggling">type-juggling</link>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>gettype</function></member>
|
||||
<member><link linkend="language.types.typecasting">type-casting</link></member>
|
||||
<member><link linkend="language.types.type-juggling">type-juggling</link></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
Loading…
Reference in a new issue