public static strpos ( string $haystack, string $needle, integer $offset, array $options = [] ) : integer | ||
$haystack | string | The string being checked. |
$needle | string | The string to find in the haystack. |
$offset | integer | If specified, search will start this number of characters counted from the beginning of the string. The offset cannot be negative. |
$options | array | Allows for selecting the adapter to use via the `name` options. Will use the `'default'` adapter by default. |
return | integer | Returns the numeric position of the first occurrence of the needle in the haystack string. If needle is not found, it returns `false`. |
public static function strpos($haystack, $needle, $offset = 0, array $options = array())
{
$defaults = array('name' => 'default');
$options += $defaults;
return static::adapter($options['name'])->strpos($haystack, $needle, $offset);
}
public function testStrpos() { Multibyte::strpos('abcab', 'c'); $result = $this->adapter->testStrposArgs; $expected = array('abcab', 'c', 0); $this->assertEqual($expected, $result); Multibyte::strpos('abcab', 'c', 23); $result = $this->adapter->testStrposArgs; $expected = array('abcab', 'c', 23); $this->assertEqual($expected, $result); }