|
5 | 5 | <refname>strripos</refname> |
6 | 6 | <refpurpose>Find the position of the last occurrence of a case-insensitive substring in a string</refpurpose> |
7 | 7 | </refnamediv> |
8 | | - |
| 8 | + |
9 | 9 | <refsect1 role="description"> |
10 | 10 | &reftitle.description; |
11 | 11 | <methodsynopsis> |
|
18 | 18 | Find the numeric position of the last occurrence of |
19 | 19 | <parameter>needle</parameter> in the <parameter>haystack</parameter> string. |
20 | 20 | </para> |
21 | | - <para> |
| 21 | + <para> |
22 | 22 | Unlike the <function>strrpos</function>, <function>strripos</function> is |
23 | 23 | case-insensitive. |
24 | 24 | </para> |
|
48 | 48 | <varlistentry> |
49 | 49 | <term><parameter>offset</parameter></term> |
50 | 50 | <listitem> |
51 | | - <para> |
| 51 | + <para> |
52 | 52 | If zero or positive, the search is performed left to right skipping the |
53 | 53 | first <parameter>offset</parameter> bytes of the |
54 | 54 | <parameter>haystack</parameter>. |
|
75 | 75 | <refsect1 role="returnvalues"> |
76 | 76 | &reftitle.returnvalues; |
77 | 77 | <para> |
78 | | - Returns the position where the needle exists relative to the beginnning of |
| 78 | + Returns the position where the <parameter>needle</parameter> exists relative to the beginning of |
79 | 79 | the <parameter>haystack</parameter> string (independent of search direction |
80 | | - or offset). |
| 80 | + or <parameter>offset</parameter>). |
81 | 81 | <note> |
82 | 82 | <simpara> |
83 | 83 | String positions start at 0, and not 1. |
84 | 84 | </simpara> |
85 | 85 | </note> |
86 | 86 | </para> |
87 | 87 | <para> |
88 | | - Returns &false; if the needle was not found. |
| 88 | + Returns &false; if the <parameter>needle</parameter> was not found. |
89 | 89 | </para> |
90 | 90 | &return.falseproblem; |
91 | 91 | </refsect1> |
|
141 | 141 | <programlisting role="php"> |
142 | 142 | <![CDATA[ |
143 | 143 | <?php |
| 144 | +
|
144 | 145 | $haystack = 'ababcd'; |
145 | 146 | $needle = 'aB'; |
146 | 147 |
|
147 | 148 | $pos = strripos($haystack, $needle); |
148 | 149 |
|
149 | 150 | if ($pos === false) { |
150 | | - echo "Sorry, we did not find ($needle) in ($haystack)"; |
| 151 | + echo "Sorry, we did not find `$needle` in `$haystack`"; |
151 | 152 | } else { |
152 | 153 | echo "Congratulations!\n"; |
153 | | - echo "We found the last ($needle) in ($haystack) at position ($pos)"; |
| 154 | + echo "We found the last `$needle` in `$haystack` at position `$pos`"; |
154 | 155 | } |
| 156 | +
|
155 | 157 | ?> |
156 | 158 | ]]> |
157 | 159 | </programlisting> |
158 | 160 | &example.outputs; |
159 | 161 | <screen> |
160 | 162 | <![CDATA[ |
161 | | - Congratulations! |
162 | | - We found the last (aB) in (ababcd) at position (2) |
| 163 | +Congratulations! |
| 164 | +We found the last `aB` in `ababcd` at position `2` |
163 | 165 | ]]> |
164 | 166 | </screen> |
165 | 167 | </example> |
|
0 commit comments