php-doc-en/reference/intl/intlcalendar/equals.xml
Adam Harvey fc1383edb3 Fix build errors.
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@332615 c90b9560-bf6c-de11-be94-00142212c4b1
2014-01-14 06:35:41 +00:00

130 lines
3.5 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="intlcalendar.equals" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>IntlCalendar::equals</refname>
<refpurpose>Compare time of two IntlCalendar objects for equality</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<para>
&style.oop;
</para>
<methodsynopsis>
<modifier>public</modifier> <type>bool</type><methodname>IntlCalendar::equals</methodname>
<methodparam><type>IntlCalendar</type><parameter>other</parameter></methodparam>
</methodsynopsis>
<para>
&style.procedural;
</para>
<methodsynopsis>
<type>bool</type><methodname>intlcal_equals</methodname>
<methodparam><type>IntlCalendar</type><parameter>cal</parameter></methodparam>
<methodparam><type>IntlCalendar</type><parameter>other</parameter></methodparam>
</methodsynopsis>
<para>
Returns true if this calendar and the given calendar have the same time.
The settings, calendar types and field states do not have to be the same.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>cal</parameter></term>
<listitem>
<para>
The IntlCalendar resource.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>other</parameter></term>
<listitem>
<para>
The calendar to compare with the primary object.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns &true; if the current time of both this and the passed in
<classname>IntlCalendar</classname> object are the same, or &false;
otherwise. The value &false; can also be returned on failure. This can only
happen if bad arguments are passed in. In any case, the two cases can be
distinguished by calling <function>intl_get_error_code</function>.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>IntlCalendar::equals</function></title>
<programlisting role="php">
<![CDATA[
<?php
ini_set('date.timezone', 'UTC');
$cal1 = IntlCalendar::createInstance(NULL, 'es_ES');
$cal2 = clone $cal1;
var_dump($cal1->equals($cal2)); //TRUE
//The locale is not included in the comparison
$cal2 = IntlCalendar::createInstance(NULL, 'pt_PT');
$cal2->setTime($cal1->getTime());
var_dump($cal1->equals($cal2)); //TRUE
//And set fields state is not included as well
$cal2->clear(IntlCalendar::FIELD_YEAR);
var_dump($cal1->isSet(IntlCalendar::FIELD_YEAR) ==
$cal2->isSet(IntlCalendar::FIELD_YEAR)); //FALSE
var_dump($cal1->equals($cal2)); //TRUE
//Neither is the calendar type
$cal2 = IntlCalendar::createInstance(NULL, 'es_ES@calendar=islamic');
$cal2->setTime($cal1->getTime());
var_dump($cal1->equals($cal2)); //TRUE
//Only the time is
$cal2 = clone $cal1;
$cal2->setTime($cal1->getTime() + 1.);
var_dump($cal1->equals($cal2)); //FALSE
]]>
</programlisting>
</example>
</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
-->