reference/strings/functions/strncasecmp.xml
a3573c18b89fd32aca1c3924d3fd9568900b4a33
...
...
@@ -1,6 +1,6 @@
1
1
<?xml version="1.0" encoding="utf-8"?>
2
2
<!-- $Revision$ -->
3
-
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.strncasecmp">
3
+
<refentry xml:id="function.strncasecmp" xmlns="http://docbook.org/ns/docbook">
4
4
<refnamediv>
5
5
<refname>strncasecmp</refname>
6
6
<refpurpose>Binary safe case-insensitive string comparison of the first n characters</refpurpose>
...
...
@@ -10,9 +10,9 @@
10
10
&reftitle.description;
11
11
<methodsynopsis>
12
12
<type>int</type><methodname>strncasecmp</methodname>
13
-
<methodparam><type>string</type><parameter>str1</parameter></methodparam>
14
-
<methodparam><type>string</type><parameter>str2</parameter></methodparam>
15
-
<methodparam><type>int</type><parameter>len</parameter></methodparam>
13
+
<methodparam><type>string</type><parameter>string1</parameter></methodparam>
14
+
<methodparam><type>string</type><parameter>string2</parameter></methodparam>
15
+
<methodparam><type>int</type><parameter>length</parameter></methodparam>
16
16
</methodsynopsis>
17
17
<para>
18
18
This function is similar to <function>strcasecmp</function>, with the
...
...
@@ -26,7 +26,7 @@
26
26
<para>
27
27
<variablelist>
28
28
<varlistentry>
29
-
<term><parameter>str1</parameter></term>
29
+
<term><parameter>string1</parameter></term>
30
30
<listitem>
31
31
<para>
32
32
The first string.
...
...
@@ -34,7 +34,7 @@
34
34
</listitem>
35
35
</varlistentry>
36
36
<varlistentry>
37
-
<term><parameter>str2</parameter></term>
37
+
<term><parameter>string2</parameter></term>
38
38
<listitem>
39
39
<para>
40
40
The second string.
...
...
@@ -42,7 +42,7 @@
42
42
</listitem>
43
43
</varlistentry>
44
44
<varlistentry>
45
-
<term><parameter>len</parameter></term>
45
+
<term><parameter>length</parameter></term>
46
46
<listitem>
47
47
<para>
48
48
The length of strings to be used in the comparison.
...
...
@@ -56,9 +56,47 @@
56
56
<refsect1 role="returnvalues">
57
57
&reftitle.returnvalues;
58
58
<para>
59
-
Returns &lt; 0 if <parameter>str1</parameter> is less than
60
-
<parameter>str2</parameter>; &gt; 0 if <parameter>str1</parameter> is
61
-
greater than <parameter>str2</parameter>, and 0 if they are equal.
59
+
Returns <literal>-1</literal> if <parameter>string1</parameter> is less than
60
+
<parameter>string2</parameter>; <literal>1</literal> if <parameter>string1</parameter> is
61
+
greater than <parameter>string2</parameter>, and <literal>0</literal> if they are equal.
62
+
</para>
63
+
</refsect1>
64
+

65
+
<refsect1 role="changelog">
66
+
&reftitle.changelog;
67
+
<informaltable>
68
+
<tgroup cols="2">
69
+
<thead>
70
+
<row>
71
+
<entry>&Version;</entry>
72
+
<entry>&Description;</entry>
73
+
</row>
74
+
</thead>
75
+
<tbody>
76
+
&standard.changelog.binary-safe-string-comparison;
77
+
</tbody>
78
+
</tgroup>
79
+
</informaltable>
80
+
</refsect1>
81
+

82
+
<refsect1 role="examples">
83
+
&reftitle.examples;
84
+
<para>
85
+
<example>
86
+
<title><function>strncasecmp</function> example</title>
87
+
<programlisting role="php">
88
+
<![CDATA[
89
+
<?php
90
+

91
+
$var1 = 'Hello John';
92
+
$var2 = 'hello Doe';
93
+
if (strncasecmp($var1, $var2, 5) === 0) {
94
+
echo 'First 5 characters of $var1 and $var2 are equals in a case-insensitive string comparison';
95
+
}
96
+
?>
97
+
]]>
98
+
</programlisting>
99
+
</example>
62
100
</para>
63
101
</refsect1>
64
102

...
...
@@ -66,18 +104,17 @@
66
104
&reftitle.seealso;
67
105
<para>
68
106
<simplelist>
107
+
<member><function>strncmp</function></member>
69
108
<member><function>preg_match</function></member>
70
-
<member><function>strcmp</function></member>
109
+
<member><function>substr_compare</function></member>
71
110
<member><function>strcasecmp</function></member>
72
-
<member><function>substr</function></member>
73
111
<member><function>stristr</function></member>
74
-
<member><function>strstr</function></member>
112
+
<member><function>substr</function></member>
75
113
</simplelist>
76
114
</para>
77
115
</refsect1>
78
116

79
117
</refentry>
80
-

81
118
<!-- Keep this comment at the end of the file
82
119
Local variables:
83
120
mode: sgml
84
121