Files
php-doc-ru/reference/classobj/functions/is-a.xml
Shein Alexey d23ff9e201 Updated translation.
git-svn-id: https://svn.php.net/repository/phpdoc/ru/trunk@308093 c90b9560-bf6c-de11-be94-00142212c4b1
2011-02-07 10:46:18 +00:00

157 lines
4.3 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: 96c9d88bad9a7d7d44bfb7f26c226df7ee9ddf26 Maintainer: shein Status: ready -->
<!-- Reviewed: no -->
<!-- $Revision$ -->
<refentry xml:id="function.is-a" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>is_a</refname>
<refpurpose>Проверяет, принадлежит ли объект к данному классу или
содержит данный класс в числе своих предков</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<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>
Проверяет, принадлежит ли объект <parameter>object</parameter>
к данному классу или содержит данный класс в числе своих предков
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>object</parameter></term>
<listitem>
<para>
Тестируемый объект
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>class_name</parameter></term>
<listitem>
<para>
Имя класса
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Возвращает &true;, если объект принадлежит данному классу или
имеет данный класс в числе своих предков, иначе возвращается &false;.
</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.3.0</entry>
<entry>
Данная функция больше не считается устаревшей, а значит,
не будет выводить <constant>E_STRICT</constant>
предупреждения.
</entry>
</row>
<row>
<entry>5.0.0</entry>
<entry>
Эта функция была помечена устаревшей в пользу оператора
<link linkend="language.operators.type">instanceof</link>.
Вызов данной функции вызовет предупреждение уровня
<constant>E_STRICT</constant>.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Пример использования <function>is_a</function></title>
<programlisting role="php">
<![CDATA[
<?php
// объявление класса
class WidgetFactory
{
var $oink = 'moo';
}
// создание нового объекта
$WF = new WidgetFactory();
if (is_a($WF, 'WidgetFactory')) {
echo "да, \$WF все еще WidgetFactory\n";
}
?>
]]>
</programlisting>
</example>
<example>
<title>Использование оператора <emphasis>instanceof</emphasis> в PHP 5</title>
<programlisting role="php">
<![CDATA[
<?php
if ($WF instanceof WidgetFactory) {
echo 'Да, $WF - WidgetFactory';
}
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>get_class</function></member>
<member><function>get_parent_class</function></member>
<member><function>is_subclass_of</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:"~/.phpdoc/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
-->