mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
WS, prepare for new doc style
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@227208 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
f1a7badf71
commit
fc05600161
15 changed files with 601 additions and 629 deletions
|
@ -1,40 +1,37 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.7 $ -->
|
||||
<!-- splitted from ./en/functions/classobj.xml, last change in rev 1.36 -->
|
||||
<refentry id="function.call-user-method-array">
|
||||
<refnamediv>
|
||||
<refname>call_user_method_array</refname>
|
||||
<refpurpose>
|
||||
Call a user method given with an array of parameters [deprecated]
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>mixed</type><methodname>call_user_method_array</methodname>
|
||||
<methodparam><type>string</type><parameter>method_name</parameter></methodparam>
|
||||
<methodparam><type>object</type><parameter role="reference">obj</parameter></methodparam>
|
||||
<methodparam><type>array</type><parameter>paramarr</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<warning>
|
||||
<para>
|
||||
The <function>call_user_method_array</function> function is deprecated
|
||||
as of PHP 4.1.0, use the <function>call_user_func_array</function> variety
|
||||
with the <literal>array(&$obj, "method_name")</literal> syntax instead.
|
||||
</para>
|
||||
</warning>
|
||||
<para>
|
||||
Calls the method referred by <parameter>method_name</parameter> from
|
||||
the user defined <parameter>obj</parameter> object, using the parameters
|
||||
in <parameter>paramarr</parameter>.
|
||||
</para>
|
||||
<para>
|
||||
See also:
|
||||
<function>call_user_func_array</function>, and
|
||||
<function>call_user_func</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<refentry id="function.call-user-method-array">
|
||||
<refnamediv>
|
||||
<refname>call_user_method_array</refname>
|
||||
<refpurpose>Call a user method given with an array of parameters [deprecated]</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>mixed</type><methodname>call_user_method_array</methodname>
|
||||
<methodparam><type>string</type><parameter>method_name</parameter></methodparam>
|
||||
<methodparam><type>object</type><parameter role="reference">obj</parameter></methodparam>
|
||||
<methodparam><type>array</type><parameter>paramarr</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<warning>
|
||||
<para>
|
||||
The <function>call_user_method_array</function> function is deprecated
|
||||
as of PHP 4.1.0, use the <function>call_user_func_array</function> variety
|
||||
with the <literal>array(&$obj, "method_name")</literal> syntax instead.
|
||||
</para>
|
||||
</warning>
|
||||
<para>
|
||||
Calls the method referred by <parameter>method_name</parameter> from
|
||||
the user defined <parameter>obj</parameter> object, using the parameters
|
||||
in <parameter>paramarr</parameter>.
|
||||
</para>
|
||||
<para>
|
||||
See also:
|
||||
<function>call_user_func_array</function>, and
|
||||
<function>call_user_func</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,52 +1,49 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.10 $ -->
|
||||
<!-- splitted from ./en/functions/classobj.xml, last change in rev 1.4 -->
|
||||
<refentry id="function.call-user-method">
|
||||
<refnamediv>
|
||||
<refname>call_user_method</refname>
|
||||
<refpurpose>
|
||||
Call a user method on an specific object [deprecated]
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>mixed</type><methodname>call_user_method</methodname>
|
||||
<methodparam><type>string</type><parameter>method_name</parameter></methodparam>
|
||||
<methodparam><type>object</type><parameter role="reference">obj</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>mixed</type><parameter>parameter</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>mixed</type><parameter>...</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<warning>
|
||||
<para>
|
||||
The <function>call_user_method</function> function is deprecated
|
||||
as of PHP 4.1.0, use the <function>call_user_func</function> variety
|
||||
with the <literal>array(&$obj, "method_name")</literal> syntax instead.
|
||||
</para>
|
||||
</warning>
|
||||
<para>
|
||||
Calls the method referred by <parameter>method_name</parameter> from
|
||||
the user defined <parameter>obj</parameter> object. An example of usage
|
||||
is below, where we define a class, instantiate an object and use
|
||||
<function>call_user_method</function> to call indirectly its
|
||||
<varname>print_info</varname> method.
|
||||
</para>
|
||||
<para>
|
||||
<informalexample>
|
||||
<programlisting role="php">
|
||||
<!-- $Revision: 1.11 $ -->
|
||||
<refentry id="function.call-user-method">
|
||||
<refnamediv>
|
||||
<refname>call_user_method</refname>
|
||||
<refpurpose>Call a user method on an specific object [deprecated]</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>mixed</type><methodname>call_user_method</methodname>
|
||||
<methodparam><type>string</type><parameter>method_name</parameter></methodparam>
|
||||
<methodparam><type>object</type><parameter role="reference">obj</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>mixed</type><parameter>parameter</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>mixed</type><parameter>...</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<warning>
|
||||
<para>
|
||||
The <function>call_user_method</function> function is deprecated
|
||||
as of PHP 4.1.0, use the <function>call_user_func</function> variety
|
||||
with the <literal>array(&$obj, "method_name")</literal> syntax instead.
|
||||
</para>
|
||||
</warning>
|
||||
<para>
|
||||
Calls the method referred by <parameter>method_name</parameter> from
|
||||
the user defined <parameter>obj</parameter> object. An example of usage
|
||||
is below, where we define a class, instantiate an object and use
|
||||
<function>call_user_method</function> to call indirectly its
|
||||
<varname>print_info</varname> method.
|
||||
</para>
|
||||
<para>
|
||||
<informalexample>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
class Country {
|
||||
var $NAME;
|
||||
var $TLD;
|
||||
|
||||
function Country($name, $tld)
|
||||
|
||||
function Country($name, $tld)
|
||||
{
|
||||
$this->NAME = $name;
|
||||
$this->TLD = $tld;
|
||||
}
|
||||
|
||||
function print_info($prestr = "")
|
||||
function print_info($prestr = "")
|
||||
{
|
||||
echo $prestr . "Country: " . $this->NAME . "\n";
|
||||
echo $prestr . "Top Level Domain: " . $this->TLD . "\n";
|
||||
|
@ -62,15 +59,15 @@ echo "\n* Calling the same method indirectly\n";
|
|||
call_user_method("print_info", $cntry, "\t");
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
</para>
|
||||
<simpara>
|
||||
See also <function>call_user_func_array</function>, and
|
||||
<function>call_user_func</function>.
|
||||
</simpara>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
</para>
|
||||
<simpara>
|
||||
See also <function>call_user_func_array</function>, and
|
||||
<function>call_user_func</function>.
|
||||
</simpara>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,27 +1,26 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.6 $ -->
|
||||
<!-- splitted from ./en/functions/classobj.xml, last change in rev 1.11 -->
|
||||
<refentry id="function.class-exists">
|
||||
<refnamediv>
|
||||
<refname>class_exists</refname>
|
||||
<refpurpose>Checks if the class has been defined</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>class_exists</methodname>
|
||||
<methodparam><type>string</type><parameter>class_name</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>bool</type><parameter>autoload</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This function returns &true; if the class given by
|
||||
<parameter>class_name</parameter> has been defined,
|
||||
&false; otherwise.
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title><function>class_exists</function> example</title>
|
||||
<programlisting role="php">
|
||||
<!-- $Revision: 1.7 $ -->
|
||||
<refentry id="function.class-exists">
|
||||
<refnamediv>
|
||||
<refname>class_exists</refname>
|
||||
<refpurpose>Checks if the class has been defined</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>class_exists</methodname>
|
||||
<methodparam><type>string</type><parameter>class_name</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>bool</type><parameter>autoload</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This function returns &true; if the class given by
|
||||
<parameter>class_name</parameter> has been defined,
|
||||
&false; otherwise.
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title><function>class_exists</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// Check the class exists before trying to use it
|
||||
|
@ -31,19 +30,19 @@ if (class_exists('MyClass')) {
|
|||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
<function>class_exists</function> will attempt to call &link.autoload; by
|
||||
default, if you don't want <function>class_exists</function> to
|
||||
call &link.autoload;, you can set the parameter <parameter>autoload</parameter>
|
||||
to &false;.
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title><parameter>autoload</parameter> parameter example</title>
|
||||
<programlisting role="php">
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
<function>class_exists</function> will attempt to call &link.autoload; by
|
||||
default, if you don't want <function>class_exists</function> to
|
||||
call &link.autoload;, you can set the parameter <parameter>autoload</parameter>
|
||||
to &false;.
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title><parameter>autoload</parameter> parameter example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
function __autoload($class)
|
||||
|
@ -55,27 +54,27 @@ function __autoload($class)
|
|||
trigger_error("Unable to load class: $class", E_USER_WARNING);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (class_exists('MyClass')) {
|
||||
$myclass = new MyClass();
|
||||
}
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
The <parameter>autoload</parameter> parameter was added in PHP 5
|
||||
</para>
|
||||
</note>
|
||||
<simpara>
|
||||
See also <function>interface_exists</function>, and
|
||||
<function>get_declared_classes</function>.
|
||||
</simpara>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
The <parameter>autoload</parameter> parameter was added in PHP 5
|
||||
</para>
|
||||
</note>
|
||||
<simpara>
|
||||
See also <function>interface_exists</function>, and
|
||||
<function>get_declared_classes</function>.
|
||||
</simpara>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,59 +1,59 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.12 $ -->
|
||||
<!-- $Revision: 1.13 $ -->
|
||||
<!-- splitted from ./en/functions/classobj.xml, last change in rev 1.2 -->
|
||||
<refentry id="function.get-class-methods">
|
||||
<refnamediv>
|
||||
<refname>get_class_methods</refname>
|
||||
<refpurpose>Returns an array of class methods' names</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>get_class_methods</methodname>
|
||||
<methodparam><type>mixed</type><parameter>class_name</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This function returns an array of method names defined for the
|
||||
class specified by <parameter>class_name</parameter>.
|
||||
In case of an error, it returns &null;
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
As of PHP 4.0.6, you can specify the object itself instead of
|
||||
<parameter>class_name</parameter>. For example:
|
||||
<informalexample>
|
||||
<programlisting role="php">
|
||||
<refentry id="function.get-class-methods">
|
||||
<refnamediv>
|
||||
<refname>get_class_methods</refname>
|
||||
<refpurpose>Returns an array of class methods' names</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>get_class_methods</methodname>
|
||||
<methodparam><type>mixed</type><parameter>class_name</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This function returns an array of method names defined for the
|
||||
class specified by <parameter>class_name</parameter>.
|
||||
In case of an error, it returns &null;
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
As of PHP 4.0.6, you can specify the object itself instead of
|
||||
<parameter>class_name</parameter>. For example:
|
||||
<informalexample>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$class_methods = get_class_methods($my_object); // see below the full example
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
</para>
|
||||
</note>
|
||||
<para>
|
||||
<example>
|
||||
<title><function>get_class_methods</function> example</title>
|
||||
<programlisting role="php">
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
</para>
|
||||
</note>
|
||||
<para>
|
||||
<example>
|
||||
<title><function>get_class_methods</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
class myclass {
|
||||
// constructor
|
||||
function myclass()
|
||||
function myclass()
|
||||
{
|
||||
return(true);
|
||||
}
|
||||
|
||||
// method 1
|
||||
function myfunc1()
|
||||
function myfunc1()
|
||||
{
|
||||
return(true);
|
||||
}
|
||||
|
||||
// method 2
|
||||
function myfunc2()
|
||||
function myfunc2()
|
||||
{
|
||||
return(true);
|
||||
}
|
||||
|
@ -69,30 +69,30 @@ foreach ($class_methods as $method_name) {
|
|||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
myclass
|
||||
myfunc1
|
||||
myfunc2
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
<warning>
|
||||
<para>
|
||||
As of PHP 5, this function returns the name of the methods as they were
|
||||
declared (case-sensitive). In PHP 4 they were lowercased.
|
||||
</para>
|
||||
</warning>
|
||||
<simpara>
|
||||
See also <function>get_class</function>,
|
||||
<function>get_class_vars</function> and
|
||||
<function>get_object_vars</function>.
|
||||
</simpara>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
<warning>
|
||||
<para>
|
||||
As of PHP 5, this function returns the name of the methods as they were
|
||||
declared (case-sensitive). In PHP 4 they were lowercased.
|
||||
</para>
|
||||
</warning>
|
||||
<simpara>
|
||||
See also <function>get_class</function>,
|
||||
<function>get_class_vars</function> and
|
||||
<function>get_object_vars</function>.
|
||||
</simpara>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,34 +1,31 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<!-- splitted from ./en/functions/classobj.xml, last change in rev 1.1 -->
|
||||
<refentry id="function.get-class-vars">
|
||||
<refnamediv>
|
||||
<refname>get_class_vars</refname>
|
||||
<refpurpose>
|
||||
Returns an array of default properties of the class
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>get_class_vars</methodname>
|
||||
<methodparam><type>string</type><parameter>class_name</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This function will return an associative array of default public
|
||||
properties of the class. The resulting array elements are in the
|
||||
form of <parameter>varname => value</parameter>.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
Prior to PHP 4.2.0, Uninitialized class variables will not be reported
|
||||
by <function>get_class_vars</function>.
|
||||
</para>
|
||||
</note>
|
||||
<para>
|
||||
<example>
|
||||
<title><function>get_class_vars</function> example</title>
|
||||
<programlisting role="php">
|
||||
<!-- $Revision: 1.10 $ -->
|
||||
<refentry id="function.get-class-vars">
|
||||
<refnamediv>
|
||||
<refname>get_class_vars</refname>
|
||||
<refpurpose>Returns an array of default properties of the class</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>get_class_vars</methodname>
|
||||
<methodparam><type>string</type><parameter>class_name</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This function will return an associative array of default public
|
||||
properties of the class. The resulting array elements are in the
|
||||
form of <parameter>varname => value</parameter>.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
Prior to PHP 4.2.0, Uninitialized class variables will not be reported
|
||||
by <function>get_class_vars</function>.
|
||||
</para>
|
||||
</note>
|
||||
<para>
|
||||
<example>
|
||||
<title><function>get_class_vars</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
|
@ -38,7 +35,7 @@ class myclass {
|
|||
var $var2 = "xyz";
|
||||
var $var3 = 100;
|
||||
private $var4; // PHP 5
|
||||
|
||||
|
||||
// constructor
|
||||
function myclass() {
|
||||
// change some properties
|
||||
|
@ -57,11 +54,11 @@ foreach ($class_vars as $name => $value) {
|
|||
echo "$name : $value\n";
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
// Before PHP 4.2.0
|
||||
var2 : xyz
|
||||
|
@ -72,15 +69,15 @@ var1 :
|
|||
var2 : xyz
|
||||
var3 : 100
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
<simpara>
|
||||
See also <function>get_class_methods</function>,
|
||||
<function>get_object_vars</function>
|
||||
</simpara>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
<simpara>
|
||||
See also <function>get_class_methods</function>,
|
||||
<function>get_object_vars</function>
|
||||
</simpara>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,50 +1,49 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<!-- splitted from ./en/functions/classobj.xml, last change in rev 1.4 -->
|
||||
<refentry id="function.get-class">
|
||||
<refnamediv>
|
||||
<refname>get_class</refname>
|
||||
<refpurpose>Returns the name of the class of an object</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>string</type><methodname>get_class</methodname>
|
||||
<methodparam choice="opt"><type>object</type><parameter>obj</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This function returns the name of the class of which the
|
||||
object <parameter>obj</parameter> is an instance. Returns
|
||||
&false; if <parameter>obj</parameter> is not an object.
|
||||
</para>
|
||||
<note>
|
||||
<simpara>
|
||||
A class defined in a PHP extension is returned in its original notation.
|
||||
In PHP 4 <function>get_class</function> returns a user defined class
|
||||
name in lowercase, but in PHP 5 it will return the class name in it's
|
||||
original notation too, just like class names from PHP extensions.
|
||||
</simpara>
|
||||
</note>
|
||||
<note>
|
||||
<para>
|
||||
Since PHP 5, <parameter>obj</parameter> is optional if called from the
|
||||
object's method.
|
||||
</para>
|
||||
</note>
|
||||
<para>
|
||||
<example>
|
||||
<title>Using <function>get_class</function></title>
|
||||
<programlisting role="php">
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<refentry id="function.get-class">
|
||||
<refnamediv>
|
||||
<refname>get_class</refname>
|
||||
<refpurpose>Returns the name of the class of an object</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>string</type><methodname>get_class</methodname>
|
||||
<methodparam choice="opt"><type>object</type><parameter>obj</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This function returns the name of the class of which the
|
||||
object <parameter>obj</parameter> is an instance. Returns
|
||||
&false; if <parameter>obj</parameter> is not an object.
|
||||
</para>
|
||||
<note>
|
||||
<simpara>
|
||||
A class defined in a PHP extension is returned in its original notation.
|
||||
In PHP 4 <function>get_class</function> returns a user defined class
|
||||
name in lowercase, but in PHP 5 it will return the class name in it's
|
||||
original notation too, just like class names from PHP extensions.
|
||||
</simpara>
|
||||
</note>
|
||||
<note>
|
||||
<para>
|
||||
Since PHP 5, <parameter>obj</parameter> is optional if called from the
|
||||
object's method.
|
||||
</para>
|
||||
</note>
|
||||
<para>
|
||||
<example>
|
||||
<title>Using <function>get_class</function></title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
class foo {
|
||||
function foo()
|
||||
function foo()
|
||||
{
|
||||
// implements some logic
|
||||
}
|
||||
|
||||
function name()
|
||||
function name()
|
||||
{
|
||||
echo "My name is " , get_class($this) , "\n";
|
||||
}
|
||||
|
@ -61,23 +60,23 @@ $bar->name();
|
|||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Its name is foo
|
||||
My name is foo
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
See also <function>get_parent_class</function>,
|
||||
<function>gettype</function>, and
|
||||
<function>is_subclass_of</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
See also <function>get_parent_class</function>,
|
||||
<function>gettype</function>, and
|
||||
<function>is_subclass_of</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,52 +1,51 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.6 $ -->
|
||||
<!-- splitted from ./en/functions/classobj.xml, last change in rev 1.11 -->
|
||||
<refentry id="function.get-declared-classes">
|
||||
<refnamediv>
|
||||
<refname>get_declared_classes</refname>
|
||||
<refpurpose>Returns an array with the name of the defined classes</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>get_declared_classes</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This function returns an array of the names of the declared classes
|
||||
in the current script.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
In PHP 4.0.1pl2, three extra classes are returned at the beginning of
|
||||
the array: <classname>stdClass</classname> (defined in
|
||||
<filename>Zend/zend.c</filename>),
|
||||
<classname>OverloadedTestClass</classname> (defined in
|
||||
<filename>ext/standard/basic_functions.c</filename>)
|
||||
and <classname>Directory</classname>
|
||||
(defined in <filename>ext/standard/dir.c</filename>).
|
||||
</para>
|
||||
<para>
|
||||
Also note that depending on what libraries you have compiled
|
||||
into PHP, additional classes could be present. This means that
|
||||
you will not be able to define your own classes using these
|
||||
names. There is a list of predefined classes in the <link
|
||||
linkend="reserved.classes">Predefined Classes</link> section of
|
||||
the appendices.
|
||||
</para>
|
||||
</note>
|
||||
<para>
|
||||
<example>
|
||||
<title><function>get_declared_classes</function> example</title>
|
||||
<programlisting role="php">
|
||||
<!-- $Revision: 1.7 $ -->
|
||||
<refentry id="function.get-declared-classes">
|
||||
<refnamediv>
|
||||
<refname>get_declared_classes</refname>
|
||||
<refpurpose>Returns an array with the name of the defined classes</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>get_declared_classes</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This function returns an array of the names of the declared classes
|
||||
in the current script.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
In PHP 4.0.1pl2, three extra classes are returned at the beginning of
|
||||
the array: <classname>stdClass</classname> (defined in
|
||||
<filename>Zend/zend.c</filename>),
|
||||
<classname>OverloadedTestClass</classname> (defined in
|
||||
<filename>ext/standard/basic_functions.c</filename>)
|
||||
and <classname>Directory</classname>
|
||||
(defined in <filename>ext/standard/dir.c</filename>).
|
||||
</para>
|
||||
<para>
|
||||
Also note that depending on what libraries you have compiled
|
||||
into PHP, additional classes could be present. This means that
|
||||
you will not be able to define your own classes using these
|
||||
names. There is a list of predefined classes in the <link
|
||||
linkend="reserved.classes">Predefined Classes</link> section of
|
||||
the appendices.
|
||||
</para>
|
||||
</note>
|
||||
<para>
|
||||
<example>
|
||||
<title><function>get_declared_classes</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
print_r(get_declared_classes());
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs.similar;
|
||||
<screen>
|
||||
</programlisting>
|
||||
&example.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Array
|
||||
(
|
||||
|
@ -55,15 +54,15 @@ Array
|
|||
[2] => Directory
|
||||
)
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
<simpara>
|
||||
See also <function>class_exists</function>, and
|
||||
<function>get_declared_interfaces</function>.
|
||||
</simpara>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
<simpara>
|
||||
See also <function>class_exists</function>, and
|
||||
<function>get_declared_interfaces</function>.
|
||||
</simpara>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,34 +1,32 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<refentry id="function.get-declared-interfaces">
|
||||
<refnamediv>
|
||||
<refname>get_declared_interfaces</refname>
|
||||
<refpurpose>
|
||||
Returns an array of all declared interfaces
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>get_declared_interfaces</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This function returns an array of the names of the declared interfaces
|
||||
in the current script.
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title><function>get_declared_interfaces</function> example</title>
|
||||
<programlisting role="php">
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<refentry id="function.get-declared-interfaces">
|
||||
<refnamediv>
|
||||
<refname>get_declared_interfaces</refname>
|
||||
<refpurpose>Returns an array of all declared interfaces</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>get_declared_interfaces</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This function returns an array of the names of the declared interfaces
|
||||
in the current script.
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title><function>get_declared_interfaces</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
print_r(get_declared_interfaces());
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs.similar;
|
||||
<screen>
|
||||
</programlisting>
|
||||
&example.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Array
|
||||
(
|
||||
|
@ -41,14 +39,14 @@ Array
|
|||
[6] => SeekableIterator
|
||||
)
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
<simpara>
|
||||
See also <function>get_declared_classes</function>.
|
||||
</simpara>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
<simpara>
|
||||
See also <function>get_declared_classes</function>.
|
||||
</simpara>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,51 +1,50 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<!-- splitted from ./en/functions/classobj.xml, last change in rev 1.1 -->
|
||||
<refentry id="function.get-object-vars">
|
||||
<refnamediv>
|
||||
<refname>get_object_vars</refname>
|
||||
<refpurpose>Returns an associative array of object properties</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>get_object_vars</methodname>
|
||||
<methodparam><type>object</type><parameter>obj</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This function returns an associative array of defined object properties
|
||||
for the specified object <parameter>obj</parameter>.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
In versions prior to PHP 4.2.0, if the variables declared in the class
|
||||
of which the <parameter>obj</parameter> is an instance, have not been
|
||||
assigned a value, those will not be returned in the array. In versions
|
||||
after PHP 4.2.0, the key will be assigned with a &null; value.
|
||||
</para>
|
||||
</note>
|
||||
<para>
|
||||
<example>
|
||||
<title>Use of <function>get_object_vars</function></title>
|
||||
<programlisting role="php">
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<refentry id="function.get-object-vars">
|
||||
<refnamediv>
|
||||
<refname>get_object_vars</refname>
|
||||
<refpurpose>Returns an associative array of object properties</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>get_object_vars</methodname>
|
||||
<methodparam><type>object</type><parameter>obj</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This function returns an associative array of defined object properties
|
||||
for the specified object <parameter>obj</parameter>.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
In versions prior to PHP 4.2.0, if the variables declared in the class
|
||||
of which the <parameter>obj</parameter> is an instance, have not been
|
||||
assigned a value, those will not be returned in the array. In versions
|
||||
after PHP 4.2.0, the key will be assigned with a &null; value.
|
||||
</para>
|
||||
</note>
|
||||
<para>
|
||||
<example>
|
||||
<title>Use of <function>get_object_vars</function></title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
class Point2D {
|
||||
var $x, $y;
|
||||
var $label;
|
||||
|
||||
function Point2D($x, $y)
|
||||
function Point2D($x, $y)
|
||||
{
|
||||
$this->x = $x;
|
||||
$this->y = $y;
|
||||
}
|
||||
|
||||
function setLabel($label)
|
||||
function setLabel($label)
|
||||
{
|
||||
$this->label = $label;
|
||||
}
|
||||
|
||||
function getPoint()
|
||||
function getPoint()
|
||||
{
|
||||
return array("x" => $this->x,
|
||||
"y" => $this->y,
|
||||
|
@ -62,9 +61,9 @@ print_r(get_object_vars($p1));
|
|||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Array
|
||||
(
|
||||
|
@ -80,15 +79,15 @@ print_r(get_object_vars($p1));
|
|||
[label] => point #1
|
||||
)
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
<simpara>
|
||||
See also <function>get_class_methods</function> and
|
||||
<function>get_class_vars</function>.
|
||||
</simpara>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
<simpara>
|
||||
See also <function>get_class_methods</function> and
|
||||
<function>get_class_vars</function>.
|
||||
</simpara>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,58 +1,57 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<!-- splitted from ./en/functions/classobj.xml, last change in rev 1.4 -->
|
||||
<refentry id="function.get-parent-class">
|
||||
<refnamediv>
|
||||
<refname>get_parent_class</refname>
|
||||
<refpurpose>Retrieves the parent class name for object or class</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>string</type><methodname>get_parent_class</methodname>
|
||||
<methodparam choice="opt"><type>mixed</type><parameter>obj</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
If <parameter>obj</parameter> is an object, returns the name of the
|
||||
parent class of the class of which <parameter>obj</parameter> is an
|
||||
instance.
|
||||
</para>
|
||||
<para>
|
||||
If <parameter>obj</parameter> is a string, returns the name of the parent
|
||||
class of the class with that name. This functionality was added in PHP
|
||||
4.0.5.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
Since PHP 5, <parameter>obj</parameter> is optional if called from the
|
||||
object's method.
|
||||
If called without parameter outside object, this function returns
|
||||
&false; (or &null; with a warning before PHP 5.1.0).
|
||||
</para>
|
||||
</note>
|
||||
<para>
|
||||
<example>
|
||||
<title>Using <function>get_parent_class</function></title>
|
||||
<programlisting role="php">
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<refentry id="function.get-parent-class">
|
||||
<refnamediv>
|
||||
<refname>get_parent_class</refname>
|
||||
<refpurpose>Retrieves the parent class name for object or class</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>string</type><methodname>get_parent_class</methodname>
|
||||
<methodparam choice="opt"><type>mixed</type><parameter>obj</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
If <parameter>obj</parameter> is an object, returns the name of the
|
||||
parent class of the class of which <parameter>obj</parameter> is an
|
||||
instance.
|
||||
</para>
|
||||
<para>
|
||||
If <parameter>obj</parameter> is a string, returns the name of the parent
|
||||
class of the class with that name. This functionality was added in PHP
|
||||
4.0.5.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
Since PHP 5, <parameter>obj</parameter> is optional if called from the
|
||||
object's method.
|
||||
If called without parameter outside object, this function returns
|
||||
&false; (or &null; with a warning before PHP 5.1.0).
|
||||
</para>
|
||||
</note>
|
||||
<para>
|
||||
<example>
|
||||
<title>Using <function>get_parent_class</function></title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
class dad {
|
||||
function dad()
|
||||
function dad()
|
||||
{
|
||||
// implements some logic
|
||||
}
|
||||
}
|
||||
|
||||
class child extends dad {
|
||||
function child()
|
||||
function child()
|
||||
{
|
||||
echo "I'm " , get_parent_class($this) , "'s son\n";
|
||||
}
|
||||
}
|
||||
|
||||
class child2 extends dad {
|
||||
function child2()
|
||||
function child2()
|
||||
{
|
||||
echo "I'm " , get_parent_class('child2') , "'s son too\n";
|
||||
}
|
||||
|
@ -63,22 +62,22 @@ $bar = new child2();
|
|||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
I'm dad's son
|
||||
I'm dad's son too
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
See also <function>get_class</function> and
|
||||
<function>is_subclass_of</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
See also <function>get_class</function> and
|
||||
<function>is_subclass_of</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,26 +1,26 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry id="function.interface-exists">
|
||||
<refnamediv>
|
||||
<refname>interface_exists</refname>
|
||||
<refpurpose>Checks if the interface has been defined</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>interface_exists</methodname>
|
||||
<methodparam><type>string</type><parameter>interface_name</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>bool</type><parameter>autoload</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This function returns &true; if the interface given by
|
||||
<parameter>interface_name</parameter> has been defined,
|
||||
&false; otherwise.
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title><function>interface_exists</function> example</title>
|
||||
<programlisting role="php">
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.interface-exists">
|
||||
<refnamediv>
|
||||
<refname>interface_exists</refname>
|
||||
<refpurpose>Checks if the interface has been defined</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>interface_exists</methodname>
|
||||
<methodparam><type>string</type><parameter>interface_name</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>bool</type><parameter>autoload</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This function returns &true; if the interface given by
|
||||
<parameter>interface_name</parameter> has been defined,
|
||||
&false; otherwise.
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title><function>interface_exists</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// Check the interface exists before trying to use it
|
||||
|
@ -33,20 +33,20 @@ if (interface_exists('MyInterface')) {
|
|||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
<function>interface_exists</function> will attempt to call &link.autoload; by
|
||||
default, if you don't want <function>interface_exists</function> to
|
||||
call &link.autoload;, you can set the parameter <parameter>autoload</parameter>
|
||||
to &false;.
|
||||
</para>
|
||||
<simpara>
|
||||
See also <function>class_exists</function>.
|
||||
</simpara>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
<function>interface_exists</function> will attempt to call &link.autoload; by
|
||||
default, if you don't want <function>interface_exists</function> to
|
||||
call &link.autoload;, you can set the parameter <parameter>autoload</parameter>
|
||||
to &false;.
|
||||
</para>
|
||||
<simpara>
|
||||
See also <function>class_exists</function>.
|
||||
</simpara>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,29 +1,25 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.7 $ -->
|
||||
<!-- splitted from ./en/functions/classobj.xml, last change in rev 1.33 -->
|
||||
<refentry id="function.is-a">
|
||||
<refnamediv>
|
||||
<refname>is_a</refname>
|
||||
<refpurpose>
|
||||
Returns &true; if the object is of this class or has this class as
|
||||
one of its parents
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>is_a</methodname>
|
||||
<methodparam><type>object</type><parameter>object</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>class_name</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This function returns &true; if the object is of this class or
|
||||
has this class as one of its parents, &false; otherwise.
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title><function>is_a</function> example</title>
|
||||
<programlisting role="php">
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<refentry id="function.is-a">
|
||||
<refnamediv>
|
||||
<refname>is_a</refname>
|
||||
<refpurpose>Returns &true; if the object is of this class or has this class as one of its parents</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>is_a</methodname>
|
||||
<methodparam><type>object</type><parameter>object</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>class_name</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This function returns &true; if the object is of this class or
|
||||
has this class as one of its parents, &false; otherwise.
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title><function>is_a</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// define a class
|
||||
|
@ -40,19 +36,19 @@ if (is_a($WF, 'WidgetFactory')) {
|
|||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
The <function>is_a</function> function is deprecated as of PHP 5 in
|
||||
favor of the <link linkend="language.operators.type">instanceof</link>
|
||||
type operator. In the above example we could use the following in
|
||||
PHP 5:
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>Using the <emphasis>instanceof</emphasis> operator in PHP 5</title>
|
||||
<programlisting role="php">
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
The <function>is_a</function> function is deprecated as of PHP 5 in
|
||||
favor of the <link linkend="language.operators.type">instanceof</link>
|
||||
type operator. In the above example we could use the following in
|
||||
PHP 5:
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>Using the <emphasis>instanceof</emphasis> operator in PHP 5</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
if ($WF instanceof WidgetFactory) {
|
||||
|
@ -60,16 +56,16 @@ if ($WF instanceof WidgetFactory) {
|
|||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<simpara>
|
||||
See also <function>get_class</function>,
|
||||
<function>get_parent_class</function>, and
|
||||
<function>is_subclass_of</function>.
|
||||
</simpara>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<simpara>
|
||||
See also <function>get_class</function>,
|
||||
<function>get_parent_class</function>, and
|
||||
<function>is_subclass_of</function>.
|
||||
</simpara>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,35 +1,32 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- splitted from ./en/functions/classobj.xml, last change in rev 1.4 -->
|
||||
<refentry id="function.is-subclass-of">
|
||||
<refnamediv>
|
||||
<refname>is_subclass_of</refname>
|
||||
<refpurpose>
|
||||
Returns &true; if the object has this class as one of its parents
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>is_subclass_of</methodname>
|
||||
<methodparam><type>mixed</type><parameter>object</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>class_name</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This function returns &true; if the object
|
||||
<parameter>object</parameter>, belongs to a class which is a
|
||||
subclass of <parameter>class_name</parameter>, &false; otherwise.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
Since PHP 5.0.3 you may also specify the <parameter>object</parameter>
|
||||
parameter as a string (the name of the class).
|
||||
</para>
|
||||
</note>
|
||||
<para>
|
||||
<example>
|
||||
<title><function>is_subclass_of</function> example</title>
|
||||
<programlisting role="php">
|
||||
<!-- $Revision: 1.6 $ -->
|
||||
<refentry id="function.is-subclass-of">
|
||||
<refnamediv>
|
||||
<refname>is_subclass_of</refname>
|
||||
<refpurpose>Returns &true; if the object has this class as one of its parents</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>is_subclass_of</methodname>
|
||||
<methodparam><type>mixed</type><parameter>object</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>class_name</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This function returns &true; if the object
|
||||
<parameter>object</parameter>, belongs to a class which is a
|
||||
subclass of <parameter>class_name</parameter>, &false; otherwise.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
Since PHP 5.0.3 you may also specify the <parameter>object</parameter>
|
||||
parameter as a string (the name of the class).
|
||||
</para>
|
||||
</note>
|
||||
<para>
|
||||
<example>
|
||||
<title><function>is_subclass_of</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// define a class
|
||||
|
@ -70,24 +67,24 @@ if (is_subclass_of('WidgetFactory_Child', 'WidgetFactory')) {
|
|||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
yes, $WFC is a subclass of WidgetFactory
|
||||
no, $WF is not a subclass of WidgetFactory
|
||||
yes, WidgetFactory_Child is a subclass of WidgetFactory
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
<simpara>
|
||||
See also <function>get_class</function>,
|
||||
<function>get_parent_class</function> and
|
||||
<function>is_a</function>.
|
||||
</simpara>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
<simpara>
|
||||
See also <function>get_class</function>,
|
||||
<function>get_parent_class</function> and
|
||||
<function>is_a</function>.
|
||||
</simpara>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,48 +1,47 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- splitted from ./en/functions/classobj.xml, last change in rev 1.9 -->
|
||||
<refentry id="function.method-exists">
|
||||
<refnamediv>
|
||||
<refname>method_exists</refname>
|
||||
<refpurpose>Checks if the class method exists</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>method_exists</methodname>
|
||||
<methodparam><type>object</type><parameter>object</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>method_name</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This function returns &true; if the method given by
|
||||
<parameter>method_name</parameter> has been defined for the given
|
||||
<parameter>object</parameter>, &false; otherwise.
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title><function>method_exists</function> example</title>
|
||||
<programlisting role="php">
|
||||
<!-- $Revision: 1.6 $ -->
|
||||
<refentry id="function.method-exists">
|
||||
<refnamediv>
|
||||
<refname>method_exists</refname>
|
||||
<refpurpose>Checks if the class method exists</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>method_exists</methodname>
|
||||
<methodparam><type>object</type><parameter>object</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>method_name</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This function returns &true; if the method given by
|
||||
<parameter>method_name</parameter> has been defined for the given
|
||||
<parameter>object</parameter>, &false; otherwise.
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title><function>method_exists</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$directory = new Directory('.');
|
||||
var_dump(method_exists($directory,'read'));
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
bool(true)
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
See also <function>function_exists</function> and
|
||||
<function>is_callable</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
See also <function>function_exists</function> and
|
||||
<function>is_callable</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<refentry id="function.property-exists">
|
||||
<refnamediv>
|
||||
<refname>property_exists</refname>
|
||||
|
@ -26,7 +26,6 @@
|
|||
</para>
|
||||
</note>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
|
@ -50,7 +49,6 @@
|
|||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
|
@ -58,7 +56,6 @@
|
|||
&null; in case of an error.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
|
@ -88,7 +85,6 @@ myClass::test();
|
|||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
|
|
Loading…
Reference in a new issue