<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.intlcalendar.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'intlcalendar.geterrorcode.php',
    1 => 'IntlCalendar::getErrorCode',
    2 => 'Get last error code on the object',
  ),
  'up' => 
  array (
    0 => 'class.intlcalendar.php',
    1 => 'IntlCalendar',
  ),
  'prev' => 
  array (
    0 => 'intlcalendar.getdayofweektype.php',
    1 => 'IntlCalendar::getDayOfWeekType',
  ),
  'next' => 
  array (
    0 => 'intlcalendar.geterrormessage.php',
    1 => 'IntlCalendar::getErrorMessage',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/intl/intlcalendar/geterrorcode.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="intlcalendar.geterrorcode" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">IntlCalendar::getErrorCode</h1>
  <h1 class="refname">intlcal_get_error_code</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.5.0, PHP 7, PHP 8, PECL &gt;= 3.0.0a1)</p><p class="refpurpose"><span class="refname">IntlCalendar::getErrorCode</span> -- <span class="refname">intlcal_get_error_code</span> &mdash; <span class="dc-title">Get last error code on the object</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-intlcalendar.geterrorcode-description">
  <h3 class="title">说明</h3>
  <p class="para">面向对象风格 (method):</p>
   <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>IntlCalendar::getErrorCode</strong></span>(): <span class="type"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="para rdfs-comment">过程化风格:</p>
  <div class="methodsynopsis dc-description"><span class="methodname"><strong>intlcal_get_error_code</strong></span>(<span class="methodparam"><span class="type"><a href="class.intlcalendar.php" class="type IntlCalendar">IntlCalendar</a></span> <code class="parameter">$calendar</code></span>): <span class="type"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="para rdfs-comment">
   Returns the numeric ICU error code for the last call on this object
   (including cloning) or the <span class="classname"><a href="class.intlcalendar.php" class="classname">IntlCalendar</a></span> given for
   the <code class="parameter">calendar</code> parameter (in the procedural‒style
   version). This may indicate only a warning (negative error code) or no
   error at all (<strong><code><a href="intl.constants.php#constant.u-zero-error">U_ZERO_ERROR</a></code></strong>). The actual presence of an
   error can be tested with <span class="function"><a href="function.intl-is-failure.php" class="function">intl_is_failure()</a></span>.
  </p>
  <p class="para">
   Invalid arguments detected on the PHP side (before invoking functions of the
   ICU library) are not recorded for the purposes of this function.
  </p>
  <p class="para">
   The last error that occurred in any call to a function of the intl
   extension, including early argument errors, can be obtained with
   <span class="function"><a href="function.intl-get-error-code.php" class="function">intl_get_error_code()</a></span>. This function resets the global
   error code, but not the objectʼs error code.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-intlcalendar.geterrorcode-parameters">
  <h3 class="title">参数</h3>
  <dl>
   
    <dt><code class="parameter">calendar</code></dt>
    <dd>
     <p class="para">
      The calendar object, on the procedural style interface.
     </p>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-intlcalendar.geterrorcode-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   An ICU error code indicating either success, failure or a warning.
   Returns <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> on failure.
  </p>
 </div>



 <div class="refsect1 examples" id="refsect1-intlcalendar.geterrorcode-examples">
  <h3 class="title">示例</h3>
  <p class="para">
   <div class="example" id="example-1">
   <p><strong>示例 #1 <span class="function"><strong>IntlCalendar::getErrorCode()</strong></span> and
   <span class="function"><a href="intlcalendar.geterrormessage.php" class="function">IntlCalendar::getErrorMessage()</a></span></strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />ini_set</span><span style="color: #007700">(</span><span style="color: #DD0000">"intl.error_level"</span><span style="color: #007700">, </span><span style="color: #0000BB">E_WARNING</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">ini_set</span><span style="color: #007700">(</span><span style="color: #DD0000">"intl.default_locale"</span><span style="color: #007700">, </span><span style="color: #DD0000">"nl"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$intlcal </span><span style="color: #007700">= new </span><span style="color: #0000BB">IntlGregorianCalendar</span><span style="color: #007700">(</span><span style="color: #0000BB">2012</span><span style="color: #007700">, </span><span style="color: #0000BB">1</span><span style="color: #007700">, </span><span style="color: #0000BB">29</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(<br />    </span><span style="color: #0000BB">$intlcal</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getErrorCode</span><span style="color: #007700">(),<br />    </span><span style="color: #0000BB">$intlcal</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getErrorMessage</span><span style="color: #007700">()<br />);<br /></span><span style="color: #0000BB">$intlcal</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">fieldDifference</span><span style="color: #007700">(-</span><span style="color: #0000BB">1e100</span><span style="color: #007700">, </span><span style="color: #0000BB">IntlCalendar</span><span style="color: #007700">::</span><span style="color: #0000BB">FIELD_SECOND</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(<br />    </span><span style="color: #0000BB">$intlcal</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getErrorCode</span><span style="color: #007700">(),<br />    </span><span style="color: #0000BB">$intlcal</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getErrorMessage</span><span style="color: #007700">()<br />);</span></span></code></div>
    </div>

    <div class="example-contents"><p>以上示例会输出：</p></div>
    <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">int(0)
string(12) &quot;U_ZERO_ERROR&quot;

Warning: IntlCalendar::fieldDifference(): intlcal_field_difference: Call to ICU method has failed in /home/glopes/php/ws/example.php on line 10
int(1)
string(81) &quot;intlcal_field_difference: Call to ICU method has failed: U_ILLEGAL_ARGUMENT_ERROR&quot;</pre>
</div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-intlcalendar.geterrorcode-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="methodname"><a href="intlcalendar.geterrormessage.php" class="methodname" rel="rdfs-seeAlso">IntlCalendar::getErrorMessage()</a> - Get last error message on the object</span></li>
    <li><span class="methodname"><a href="function.intl-is-failure.php" class="methodname" rel="rdfs-seeAlso">intl_is_failure()</a> - Check whether the given error code indicates failure</span></li>
    <li><span class="methodname"><a href="function.intl-error-name.php" class="methodname" rel="rdfs-seeAlso">intl_error_name()</a> - Get symbolic name for a given error code</span></li>
    <li><span class="methodname"><a href="function.intl-get-error-code.php" class="methodname" rel="rdfs-seeAlso">intl_get_error_code()</a> - Get the last error code</span></li>
    <li><span class="methodname"><a href="function.intl-get-error-message.php" class="methodname" rel="rdfs-seeAlso">intl_get_error_message()</a> - Get description of the last error</span></li>
   </ul>
  </p>
 </div>


</div><?php manual_footer($setup); ?>