Files
php-doc-ru/reference/classobj/functions/property-exists.xml
2008-04-14 13:46:59 +00:00

119 lines
3.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: 1.7 Status: ready -->
<!-- $Revision: 1.1 $ -->
<refentry xml:id="function.property-exists" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>property_exists</refname>
<refpurpose>
Проверяет, содержит ли объект или класс указанный атрибут
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>property_exists</methodname>
<methodparam><type>mixed</type><parameter>class</parameter></methodparam>
<methodparam><type>string</type><parameter>property</parameter></methodparam>
</methodsynopsis>
<para>
Функция проверяет, существует ли атрибут <parameter>property</parameter>
в определенном классе (и доступно ли оно из текущей области видимости).
</para>
<note>
<para>
В противоположность <function>isset</function>,
<function>property_exists</function> возвращает &true; даже если свойство
имеет значение &null;.
</para>
</note>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>class</parameter></term>
<listitem>
<para>
Имя класса или объекта класса для проверки
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>property</parameter></term>
<listitem>
<para>
Имя свойства
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Возвращает &true;, если свойство существует, &false; - если оно не существует или
&null; в случае ошибки.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Пример использования <function>property_exists</function></title>
<programlisting role="php">
<![CDATA[
<?php
class myClass {
public $mine;
private $xpto;
static function test() {
var_dump(property_exists('myClass', 'xpto')); // true, отсюда есть доступ к свойству
}
}
var_dump(property_exists('myClass', 'mine')); //true
var_dump(property_exists(new myClass, 'mine')); //true
var_dump(property_exists('myClass', 'xpto')); //false, свойство не public
myClass::test();
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>method_exists</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
-->