<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Get last error code on the object</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="intlcalendar.getdayofweektype.html">IntlCalendar::getDayOfWeekType</a></div> <div class="next" style="text-align: right; float: right;"><a href="intlcalendar.geterrormessage.html">IntlCalendar::getErrorMessage</a></div> <div class="up"><a href="class.intlcalendar.html">IntlCalendar</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><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.5.0, PECL >= 3.0.0a1)</p><p class="refpurpose"><span class="refname">IntlCalendar::getErrorCode</span> -- <span class="refname">intlcal_get_error_code</span> — <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">Description</h3> <p class="para">Object oriented style (method):</p> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">int</span> <span class="methodname"><strong>IntlCalendar::getErrorCode</strong></span> ( <span class="methodparam">void</span> )</div> <p class="para rdfs-comment">Procedural style:</p> <div class="methodsynopsis dc-description"> <span class="type">int</span> <span class="methodname"><strong>intlcal_get_error_code</strong></span> ( <span class="methodparam"><span class="type"><a href="class.intlcalendar.html" class="type IntlCalendar">IntlCalendar</a></span> <code class="parameter">$calendar</code></span> )</div> <p class="para rdfs-comment"> Returns the numeric ICU error code for the last call on this object (including cloning) or the <a href="class.intlcalendar.html" class="classname">IntlCalendar</a> given for the <em><code class="parameter">calendar</code></em> parameter (in the procedural‒style version). This may indicate only a warning (negative error code) or no error at all (<strong><code>U_ZERO_ERROR</code></strong>). The actual presence of an error can be tested with <span class="function"><a href="function.intl-is-failure.html" 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.html" 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">Parameters</h3> <dl> <dt> <span class="term"><em><code class="parameter">calendar</code></em></span> <dd> <p class="para"> The calendar object, on the procedural style interface. </p> </dd> </dt> </dl> </div> <div class="refsect1 returnvalues" id="refsect1-intlcalendar.geterrorcode-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> An ICU error code indicating either success, failure or a warning. </p> </div> <div class="refsect1 examples" id="refsect1-intlcalendar.geterrorcode-examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example" id="example-2602"> <p><strong>Example #1 <span class="function"><strong>IntlCalendar::getErrorCode()</strong></span> and <span class="function"><a href="intlcalendar.geterrormessage.html" class="function">IntlCalendar::getErrorMessage()</a></span></strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?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">-></span><span style="color: #0000BB">getErrorCode</span><span style="color: #007700">(),<br /> </span><span style="color: #0000BB">$intlcal</span><span style="color: #007700">-></span><span style="color: #0000BB">getErrorMessage</span><span style="color: #007700">()<br />);<br /></span><span style="color: #0000BB">$intlcal</span><span style="color: #007700">-></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">-></span><span style="color: #0000BB">getErrorCode</span><span style="color: #007700">(),<br /> </span><span style="color: #0000BB">$intlcal</span><span style="color: #007700">-></span><span style="color: #0000BB">getErrorMessage</span><span style="color: #007700">()<br />);</span> </span> </code></div> </div> <div class="example-contents"><p>The above example will output:</p></div> <div class="example-contents screen"> <div class="cdata"><pre> int(0) string(12) "U_ZERO_ERROR" 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) "intlcal_field_difference: Call to ICU method has failed: U_ILLEGAL_ARGUMENT_ERROR" </pre></div> </div> </div> </p> </div> <div class="refsect1 seealso" id="refsect1-intlcalendar.geterrorcode-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"> <span class="methodname"><a href="intlcalendar.geterrormessage.html" class="methodname" rel="rdfs-seeAlso">IntlCalendar::getErrorMessage()</a> - Get last error message on the object</span></li> <li class="member"> <span class="methodname"><a href="function.intl-is-failure.html" class="methodname" rel="rdfs-seeAlso">intl_is_failure()</a> - Check whether the given error code indicates failure</span></li> <li class="member"> <span class="methodname"><a href="function.intl-error-name.html" class="methodname" rel="rdfs-seeAlso">intl_error_name()</a> - Get symbolic name for a given error code</span></li> <li class="member"> <span class="methodname"><a href="function.intl-get-error-code.html" class="methodname" rel="rdfs-seeAlso">intl_get_error_code()</a> - Get the last error code</span></li> <li class="member"> <span class="methodname"><a href="function.intl-get-error-message.html" class="methodname" rel="rdfs-seeAlso">intl_get_error_message()</a> - Get description of the last error</span></li> </ul> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="intlcalendar.getdayofweektype.html">IntlCalendar::getDayOfWeekType</a></div> <div class="next" style="text-align: right; float: right;"><a href="intlcalendar.geterrormessage.html">IntlCalendar::getErrorMessage</a></div> <div class="up"><a href="class.intlcalendar.html">IntlCalendar</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>