reference/intl/dateformatter/get-error-code.xml
a4e79bc8e416903081feb590ce009132726a5712
...
...
@@ -23,10 +23,9 @@
23
23
<methodparam><type>IntlDateFormatter</type><parameter>formatter</parameter></methodparam>
24
24
</methodsynopsis>
25
25
<para>
26
-
Get the error code from last operation.
27
-
Returns error code from the last number formatting operation.
26
+
Returns the error code from the last formatting operation.
28
27
</para>
29
-
</refsect1>
28
+
</refsect1>
30
29

31
30
<refsect1 role="parameters">
32
31
&reftitle.parameters;
...
...
@@ -44,21 +43,21 @@
44
43
</para>
45
44
</refsect1>
46
45

47
-
48
46
<refsect1 role="returnvalues">
49
47
&reftitle.returnvalues;
50
48
<para>
51
49
The error code, one of UErrorCode values. Initial value is U_ZERO_ERROR.
52
-
</para>
50
+
</para>
53
51
</refsect1>
54
52

55
53
<refsect1 role="examples">
56
54
&reftitle.examples;
57
-
<example>
58
-
<title><function>datefmt_get_error_code</function> example</title>
59
-
<programlisting role="php">
55
+
<example>
56
+
<title><function>datefmt_get_error_code</function> example</title>
57
+
<programlisting role="php">
60
58
<![CDATA[
61
59
<?php
60
+

62
61
$fmt = datefmt_create(
63
62
'en_US',
64
63
IntlDateFormatter::FULL,
...
...
@@ -66,23 +65,23 @@ $fmt = datefmt_create(
66
65
'America/Los_Angeles',
67
66
IntlDateFormatter::GREGORIAN
68
67
);
69
-
$str = datefmt_format($fmt);
70
-
if (!$str) {
71
-
printf(
72
-
"ERROR: %s (%d)\n",
73
-
datefmt_get_error_message($fmt),
74
-
datefmt_get_error_code($fmt)
75
-
);
76
-
}
68
+
$str = datefmt_format($fmt, 0);
69
+

70
+
printf(
71
+
"ERROR: %s (%d)\n",
72
+
datefmt_get_error_message($fmt),
73
+
datefmt_get_error_code($fmt)
74
+
);
77
75
?>
78
76
]]>
79
-
</programlisting>
80
-
</example>
81
-
<example>
82
-
<title>OO example</title>
83
-
<programlisting role="php">
77
+
</programlisting>
78
+
</example>
79
+
<example>
80
+
<title>OO example</title>
81
+
<programlisting role="php">
84
82
<![CDATA[
85
83
<?php
84
+

86
85
$fmt = new IntlDateFormatter(
87
86
'en_US',
88
87
IntlDateFormatter::FULL,
...
...
@@ -90,34 +89,33 @@ $fmt = new IntlDateFormatter(
90
89
'America/Los_Angeles',
91
90
IntlDateFormatter::GREGORIAN
92
91
);
93
-
$str = $fmt->format();
94
-
if (!$str) {
95
-
printf(
96
-
"ERROR: %s (%d)\n",
97
-
$fmt->getErrorMessage(),
98
-
$fmt->getErrorCode()
99
-
);
100
-
}
92
+
$str = $fmt->format(0);
93
+

94
+
printf(
95
+
"ERROR: %s (%d)\n",
96
+
$fmt->getErrorMessage(),
97
+
$fmt->getErrorCode()
98
+
);
101
99
?>
102
100
]]>
103
-
</programlisting>
104
-
</example>
105
-
&example.outputs;
106
-
<screen>
107
-
<![CDATA[
101
+
</programlisting>
102
+
</example>
103
+
&example.outputs;
104
+
<screen>
105
+
<![CDATA[
108
106
ERROR: U_ZERO_ERROR (0)
109
107
]]>
110
-
</screen>
108
+
</screen>
111
109
</refsect1>
112
110

113
111
<refsect1 role="seealso">
114
112
&reftitle.seealso;
115
113
<para>
116
-
<simplelist>
114
+
<simplelist>
117
115
<member><function>datefmt_get_error_message</function></member>
118
116
<member><function>intl_get_error_code</function></member>
119
117
<member><function>intl_is_failure</function></member>
120
-
</simplelist>
118
+
</simplelist>
121
119
</para>
122
120
</refsect1>
123
121
</refentry>
124
122