2002-04-15 00:12:54 +00:00
|
|
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
2007-06-20 22:25:43 +00:00
|
|
|
<!-- $Revision: 1.11 $ -->
|
|
|
|
<refentry xml:id="function.get-class" xmlns="http://docbook.org/ns/docbook">
|
2007-01-14 13:37:31 +00:00
|
|
|
<refnamediv>
|
|
|
|
<refname>get_class</refname>
|
|
|
|
<refpurpose>Returns the name of the class of an object</refpurpose>
|
|
|
|
</refnamediv>
|
2007-01-14 15:10:19 +00:00
|
|
|
<refsect1 role="description">
|
|
|
|
&reftitle.description;
|
2007-01-14 13:37:31 +00:00
|
|
|
<methodsynopsis>
|
|
|
|
<type>string</type><methodname>get_class</methodname>
|
2007-01-14 15:10:19 +00:00
|
|
|
<methodparam choice="opt"><type>object</type><parameter>object</parameter></methodparam>
|
2007-01-14 13:37:31 +00:00
|
|
|
</methodsynopsis>
|
|
|
|
<para>
|
2007-01-14 15:10:19 +00:00
|
|
|
Gets the name of the class of the given <parameter>object</parameter>.
|
2007-01-14 13:37:31 +00:00
|
|
|
</para>
|
2007-01-14 15:10:19 +00:00
|
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
|
|
&reftitle.parameters;
|
|
|
|
<para>
|
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>object</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
The tested object
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
|
|
&reftitle.returnvalues;
|
|
|
|
<para>
|
|
|
|
Returns the name of the class of which <parameter>object</parameter> is an
|
|
|
|
instance. Returns &false; if <parameter>object</parameter> is not an
|
|
|
|
object.
|
|
|
|
</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>Since 5.0.0</entry>
|
|
|
|
<entry>
|
|
|
|
The class name is returned in it's original notation.
|
|
|
|
</entry>
|
|
|
|
</row>
|
|
|
|
<row>
|
|
|
|
<entry>Since 5.0.0</entry>
|
|
|
|
<entry>
|
|
|
|
The <parameter>object</parameter> parameter is optional if called
|
|
|
|
from the object's method.
|
|
|
|
</entry>
|
|
|
|
</row>
|
|
|
|
</tbody>
|
|
|
|
</tgroup>
|
|
|
|
</informaltable>
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
|
|
&reftitle.examples;
|
2007-01-14 13:37:31 +00:00
|
|
|
<para>
|
|
|
|
<example>
|
|
|
|
<title>Using <function>get_class</function></title>
|
|
|
|
<programlisting role="php">
|
2003-07-03 11:26:06 +00:00
|
|
|
<![CDATA[
|
|
|
|
<?php
|
|
|
|
|
|
|
|
class foo {
|
2007-01-14 13:37:31 +00:00
|
|
|
function foo()
|
2004-01-15 12:43:50 +00:00
|
|
|
{
|
2003-07-03 11:26:06 +00:00
|
|
|
// implements some logic
|
|
|
|
}
|
|
|
|
|
2007-01-14 13:37:31 +00:00
|
|
|
function name()
|
2004-01-15 12:43:50 +00:00
|
|
|
{
|
2003-07-03 11:26:06 +00:00
|
|
|
echo "My name is " , get_class($this) , "\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// create an object
|
|
|
|
$bar = new foo();
|
|
|
|
|
|
|
|
// external call
|
|
|
|
echo "Its name is " , get_class($bar) , "\n";
|
|
|
|
|
|
|
|
// internal call
|
|
|
|
$bar->name();
|
|
|
|
|
|
|
|
?>
|
|
|
|
]]>
|
2007-01-14 13:37:31 +00:00
|
|
|
</programlisting>
|
|
|
|
&example.outputs;
|
|
|
|
<screen>
|
2003-07-03 11:26:06 +00:00
|
|
|
<![CDATA[
|
|
|
|
Its name is foo
|
|
|
|
My name is foo
|
|
|
|
]]>
|
2007-01-14 13:37:31 +00:00
|
|
|
</screen>
|
|
|
|
</example>
|
|
|
|
</para>
|
2007-01-14 15:10:19 +00:00
|
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
|
|
&reftitle.seealso;
|
2007-01-14 13:37:31 +00:00
|
|
|
<para>
|
2007-01-14 15:10:19 +00:00
|
|
|
<simplelist>
|
|
|
|
<member><function>get_parent_class</function></member>
|
|
|
|
<member><function>gettype</function></member>
|
|
|
|
<member><function>is_subclass_of</function></member>
|
|
|
|
</simplelist>
|
2007-01-14 13:37:31 +00:00
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
</refentry>
|
2002-04-15 00:12:54 +00:00
|
|
|
|
|
|
|
<!-- 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
|
|
|
|
-->
|