Documentation

getLastPosition

boolean|integer public static
\Bitrix\Main\Text\BinaryString::getLastPosition(
  $haystack,
  $needle,
 integer $offset
);

Static method searches position of the last needle substring entry in haystack. Executes safe operation in terms of multibyte character sets. Returns number of position for the last original search substring relative to the haystack string start, independent from search direction and offset. String position is counted from 0, not from 1. Returns false, when original search string is not found. Similar to PHP function strrpos.

Parameters

ParameterDescriptionVersion
$haystackSting, containing the search.
$needleOriginal search substring. If it is not a string, converted to integer and deemed as character code.
$offsetOffset. When this parameter is specified, starts the search from the indicated number of characters offset from start of string. When value is negative, starts the search from the indicated number of characters from end of string, while continuing to search the lastest entry.

Example



© «Bitrix24», 2001-2024
Up