/** * UTF-8 aware replacement for stripos(). * * Returns the position of the first occurrence of $sub in the $str. If $sub * is not found, it returns false. * * This will get alot slower if an negative $offset is used. * * This function may return boolean false, but may also return a non-boolean 0 * which evaluates to false. Use the === operator for testing the return value * of this function. * * @param string $str The string to search in * @param string $sub The string to search for * @param int $offset If presented, it specifies the position in the string * to begin the search * @return int The position or false on failure */ function utf8_isearch($str, $sub, $offset = 0) { return utf8_search($str, $sub, $offset, true); }
/** * @dataProvider providerFailingUtf8ISearch */ public function testFailingUtf8ISearchReturnValue($str, $sub, $offset) { $this->assertFalse(@utf8_search($str, $sub, $offset)); }