Lines Matching defs:offset
72 * Return part of a string given character offset (and optionally length)
75 * @param int $offset number of UTF-8 characters offset (from left)
76 * @param int $length (optional) length in UTF-8 characters from offset
82 public static function substr($str, $offset, $length = null)
86 return mb_substr($str, $offset);
89 return mb_substr($str, $offset, $length);
97 * offset and length, we'll repeat a group of 65535 characters when needed (ok, up to MAXINT-65536)
99 * substr documentation states false can be returned in some cases (e.g. offset > string length)
108 $offset = (int)$offset;
113 if ($offset < 0 && $length < 0 && $length < $offset) return '';
119 if ($offset < 0) {
121 $offset = $strlen + $offset;
122 if ($offset < 0) $offset = 0;
125 // establish a pattern for offset, a non-captured group equal in length to offset
126 if ($offset > 0) {
127 $Ox = (int)($offset / 65535);
128 $Oy = $offset % 65535;
133 $offset_pattern = '^'; // offset == 0; just anchor the pattern
141 if ($offset > $strlen) return ''; // another trivial case
145 $length = min($strlen - $offset, $length);
152 if ($length < ($offset - $strlen)) return '';
172 * @param int $start the replacing will begin at the start'th offset into string.
175 * replacement into string at the given start offset.
348 * @param integer $offset
354 public static function strpos($haystack, $needle, $offset = 0)
359 while ($length === null || $length < $offset) {
360 $pos = strpos($haystack, $needle, $offset + $comp);
367 if ($length < $offset)