1 | <?php namespace Gears\String\Methods; |
||
16 | trait IndexOf |
||
17 | { |
||
18 | /** |
||
19 | * Returns the index of the first occurrence of $needle in the string, |
||
20 | * and false if not found. Accepts an optional offset from which to begin |
||
21 | * the search. |
||
22 | * |
||
23 | * @param string $needle Substring to look for. |
||
24 | * |
||
25 | * @param int $offset Offset from which to search. |
||
26 | * |
||
27 | * @return int|bool The occurrence's index if found, |
||
28 | * otherwise false. |
||
29 | */ |
||
30 | public function indexOf($needle, $offset = 0) |
||
40 | |||
41 | /** |
||
42 | * Returns the index of the last occurrence of $needle in the string, |
||
43 | * and false if not found. Accepts an optional offset from which to begin |
||
44 | * the search. Offsets may be negative to count from the last character |
||
45 | * in the string. |
||
46 | * |
||
47 | * @param string $needle Substring to look for. |
||
48 | * |
||
49 | * @param int $offset Offset from which to search. |
||
50 | * |
||
51 | * @return int|bool The last occurrence's index if found, |
||
52 | * otherwise false. |
||
53 | */ |
||
54 | public function indexOfLast($needle, $offset = 0) |
||
64 | } |
||
65 |