1
0
mirror of https://github.com/php/doc-ru.git synced 2026-03-24 07:42:22 +01:00
Files
archived-doc-ru/reference/com/variant.xml
2024-06-14 17:02:33 +01:00

98 lines
3.5 KiB
XML
Raw Permalink 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: 14767af0f05dffa6fdb9b49e1a1f4e9ca7022a60 Maintainer: rjhdby Status: ready -->
<!-- Reviewed: no -->
<reference xml:id="class.variant" role="class" xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude">
<titleabbrev>variant</titleabbrev>
<title>Класс variant</title>
<partintro>
<!-- {{{ variant intro -->
<section xml:id="variant.intro">
&reftitle.intro;
<para>
VARIANT — это эквивалент zval для COM; это структура, которая может
содержать значения различных допустимых типов. Класс variant
входит в модуль COM и позволяет больше контролировать
значения, передаваемые от PHP к COM и обратно.
</para>
</section>
<!-- }}} -->
<section xml:id="variant.synopsis">
&reftitle.classsynopsis;
<!-- {{{ Synopsis -->
<classsynopsis class="class">
<ooclass>
<classname>variant</classname>
</ooclass>
<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.variant')/db:refentry/db:refsect1[@role='description']/descendant::db:constructorsynopsis[@role='variant'])">
<xi:fallback/>
</xi:include>
</classsynopsis>
<!-- }}} -->
</section>
<section xml:id="class.variant.examples">
<title>Примеры variant</title>
<para>
<example xml:id="com.variant.example.php5">
<title>Пример использования variant</title>
<programlisting role="php">
<![CDATA[
<?php
$v = new variant(42);
print "Тип — " . variant_get_type($v) . "<br/>";
print "Значение — " . $v . "<br/>";
?>
]]>
</programlisting>
</example>
</para>
<note>
<para>
Когда возвращается
значение или извлекается свойство, variant преобразовывается в значение PHP
только если есть прямая связь между типами, что не приведёт
к потере информации. Во всех остальных случаях результат вернётся в виде
экземпляра класса variant. Вы можете принудительно указать PHP
конвертировать значения в типы PHP используя оператор приведения типов
или же преобразовывать их в строку, используя функцию <function>print</function>.
Вы можете использовать множество функций класса для арифметических
операций без приведения значений к типам PHP с риском потери информации.
</para>
</note>
<para>
Смотрите также <function>variant_get_type</function>.
</para>
</section>
</partintro>
&reference.com.entities.variant;
</reference>
<!-- 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
-->