Forum Webscript.Ru

Программирование => PHP => Тема начата: Iluxa от 08 Июля 2003, 07:14:30

Название: Аналоги функций
Отправлено: Iluxa от 08 Июля 2003, 07:14:30
В Perl есть удобная функция Index()
Она определяет позицию элемента в строке, например:
$sub=index($stroka, $element);
$sub - это будет числовое значение, а именно номер первого символа $element в строке $stroka.

Есть ли аналог этой функции в PHP, и если есть, прошу привести ее синтаксис!:D
Название: Аналоги функций
Отправлено: nagash от 08 Июля 2003, 07:30:44
int stripos ( string haystack, string needle [, int offset])


Returns the numeric position of the first occurrence of needle in the haystack string. Unlike strpos(), stripos() is case-insensitive. And unlike strrpos(), this function can take a full string as the needle parameter and the entire string will be used.

If needle is not found, strpos() will return boolean FALSE.