mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-20 19:08:54 +00:00

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@148756 c90b9560-bf6c-de11-be94-00142212c4b1
110 lines
2.4 KiB
XML
110 lines
2.4 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.7 $ -->
|
|
<!-- 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>.
|
|
</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_class); // see below the full example
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</informalexample>
|
|
</para>
|
|
</note>
|
|
<para>
|
|
<example>
|
|
<title><function>get_class_methods</function> example</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
|
|
class myclass {
|
|
// constructor
|
|
function myclass()
|
|
{
|
|
return(true);
|
|
}
|
|
|
|
// method 1
|
|
function myfunc1()
|
|
{
|
|
return(true);
|
|
}
|
|
|
|
// method 2
|
|
function myfunc2()
|
|
{
|
|
return(true);
|
|
}
|
|
}
|
|
|
|
$my_object = new myclass();
|
|
|
|
$class_methods = get_class_methods(get_class($my_object));
|
|
|
|
foreach ($class_methods as $method_name) {
|
|
echo "$method_name\n";
|
|
}
|
|
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
<para>
|
|
Will produce:
|
|
</para>
|
|
<screen>
|
|
<![CDATA[
|
|
myclass
|
|
myfunc1
|
|
myfunc2
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
<simpara>
|
|
See also <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:
|
|
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
|
|
-->
|