mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-27 06:18:56 +00:00

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@271308 c90b9560-bf6c-de11-be94-00142212c4b1
174 lines
4.7 KiB
XML
174 lines
4.7 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision: 1.7 $ -->
|
|
<refentry xml:id="intldateformatter.islenient" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
<refnamediv>
|
|
<refname>IntlDateFormatter::isLenient</refname>
|
|
<refname>datefmt_is_lenient</refname>
|
|
<refpurpose>Get the lenient used for the IntlDateFormatter</refpurpose>
|
|
</refnamediv>
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<para>
|
|
Object oriented style
|
|
</para>
|
|
<methodsynopsis>
|
|
<type>bool</type><methodname>IntlDateFormatter::isLenient</methodname>
|
|
<void />
|
|
</methodsynopsis>
|
|
<para>
|
|
Procedural style
|
|
</para>
|
|
<methodsynopsis>
|
|
<type>bool</type><methodname>datefmt_is_lenient</methodname>
|
|
<methodparam><type>IntlDateFormatter</type><parameter>fmt</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Check if the parser is strict or lenient in interpreting inputs that do not match the pattern exactly.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>fmt</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
The formatter resource.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
&true; if parser is lenient, &false; if parser is strict. By default the parser is strict.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<example>
|
|
<title><function>datefmt_is_lenient</function> example</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$fmt = datefmt_create( "en_US" ,IntlDateFormatter::FULL,IntlDateFormatter::FULL,'America/Los_Angeles',IntlDateFormatter::GREGO
|
|
RIAN ,"dd/mm/yyyy");
|
|
echo "lenient of the formatter is : ";
|
|
if( $fmt->isLenient() ){
|
|
echo('TRUE');
|
|
}else{
|
|
echo('FALSE');
|
|
}
|
|
datefmt_parse($fmt,"35/13/1971");
|
|
echo "\n Trying to do parse('35/13/1971').Result is : " .datefmt_parse($fmt,"35/13/1971");
|
|
if( intl_get_error_code() !=0 ){
|
|
echo "Error_msg is : ".intl_get_error_message();
|
|
echo "Error_code is : ".intl_get_error_code();
|
|
}
|
|
datefmt_set_lenient($fmt,false);
|
|
echo "Now lenient of the formatter is : ";
|
|
if( $fmt->isLenient() ){
|
|
echo('TRUE');
|
|
}else{
|
|
echo('FALSE');
|
|
}
|
|
datefmt_parse($fmt,"35/13/1971");
|
|
echo "\n Trying to do parse('35/13/1971').Result is : " .datefmt_parse($fmt,"35/13/1971");
|
|
if( intl_get_error_code() !=0 ){
|
|
echo "Error_msg is : ".intl_get_error_message();
|
|
echo "Error_code is : ".intl_get_error_code();
|
|
}
|
|
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
<example>
|
|
<title>OO example</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$fmt = new IntlDateFormatter( "en_US" ,IntlDateFormatter::FULL,IntlDateFormatter::FULL,'America/Los_Angeles',IntlDateFormatter::GRE
|
|
GORIAN,"dd/mm/yyyy" );
|
|
echo "lenient of the formatter is : ";
|
|
if( $fmt->isLenient() ){
|
|
echo('TRUE');
|
|
}else{
|
|
echo('FALSE');
|
|
}
|
|
$fmt->parse("35/13/1971");
|
|
echo "\n Trying to do parse('35/13/1971').Result is : " .$fmt->parse("35/13/1971");
|
|
if( intl_get_error_code() !=0 ){
|
|
echo "Error_msg is : ".intl_get_error_message();
|
|
echo "Error_code is : ".intl_get_error_code();
|
|
}
|
|
|
|
$fmt->setLenient(FALSE);
|
|
echo "Now lenient of the formatter is : ";
|
|
if( $fmt->isLenient() ){
|
|
echo('TRUE');
|
|
}else{
|
|
echo('FALSE');
|
|
}
|
|
$fmt->parse("35/13/1971");
|
|
echo "\n Trying to do parse('35/13/1971').Result is : " .$fmt->parse("35/13/1971");
|
|
if( intl_get_error_code() !=0 ){
|
|
echo "Error_msg is : ".intl_get_error_message();
|
|
echo "Error_code is : ".intl_get_error_code();
|
|
}
|
|
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
&example.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
lenient of the formatter is : TRUE
|
|
Trying to do parse('35/13/1971').
|
|
Result is : -2147483
|
|
Now lenient of the formatter is : FALSE
|
|
Trying to do parse('35/13/1971').
|
|
Result is : Error_msg is : Date parsing failed: U_PARSE_ERROR Error_code is : 9
|
|
]]>
|
|
</screen>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>datefmt_set_lenient</function></member>
|
|
<member><function>datefmt_create</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
|
|
-->
|