mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-21 03:18:55 +00:00

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@195871 c90b9560-bf6c-de11-be94-00142212c4b1
157 lines
3.4 KiB
XML
Executable file
157 lines
3.4 KiB
XML
Executable file
<?xml version='1.0' encoding='iso-8859-1'?>
|
|
<!-- $Revision: 1.10 $ -->
|
|
<refentry id="function.class-implements">
|
|
<refnamediv>
|
|
<refname>class_implements</refname>
|
|
<refpurpose>
|
|
Return the interfaces which are implemented by the given class
|
|
</refpurpose>
|
|
</refnamediv>
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>array</type><methodname>class_implements</methodname>
|
|
<methodparam><type>mixed</type><parameter>class</parameter></methodparam>
|
|
<methodparam choice="opt"><type>bool</type><parameter>autoload</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
This function returns an array with the names of the interfaces that the
|
|
given <parameter>class</parameter> and its parents implement.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>class</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
An object (class instance) or a string (class name).
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>autoload</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Whether to allow this function to load the class automatically through
|
|
the <link linkend="language.oop5.autoload">__autoload</link> magic
|
|
method. Defaults to &true;.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Returns an array or &false; on error.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="changelog">
|
|
&reftitle.changelog;
|
|
<para>
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>&Version;</entry>
|
|
<entry>&Description;</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>5.1.0</entry>
|
|
<entry>
|
|
Added the option to pass the <parameter>class</parameter> parameter as
|
|
a string. Added the <parameter>autoload</parameter> parameter.
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title><function>class_implements</function> example</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
|
|
interface foo { }
|
|
class bar implements foo {}
|
|
|
|
print_r(class_implements(new bar));
|
|
|
|
// since PHP 5.1 you may also specify the parameter as a string
|
|
print_r(class_implements('bar'));
|
|
|
|
|
|
function __autoload($class_name) {
|
|
require_once $class_name . '.php';
|
|
}
|
|
|
|
// use __autoload to load the 'not_loaded' class
|
|
print_r(class_implements('not_loaded', true));
|
|
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs.similar;
|
|
<screen>
|
|
<![CDATA[
|
|
Array
|
|
(
|
|
[foo] => foo
|
|
)
|
|
|
|
Array
|
|
(
|
|
[interface_of_not_loaded] => interface_of_not_loaded
|
|
)
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>class_parents</function></member>
|
|
</simplelist>
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"../../../../manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|