Parameters
$text - The text to be searched.
$find - The search value.
$start - The search start index.
$exact - Indicates if a case sensitive search is performed.
Returns
The integer index value.
Syntax
PHP |
public static function StrRPos(?string $text, ?string $find , int $start = 0, bool $exact = false) : int
|
Gets the last index for the search value. (E)
Remarks
The integer -1 is returned if the search value is not found. It can be
simply tested for success $index >= 0 or failure $index < 0.
This alternative for PHP strpos() always returns an integer.
Example
PHP |
$webCommonPath = "c:/inetpub/wwwroot/LJCPHPCommon";
require_once "$webCommonPath/LJCCommonLib.php";
// $index = 13
$index = LJCCommon::StrRPos("This here is here.", "Here");
// $index = -1
$index = LJCCommon::StrRPos("This here is here.", "Here", exact: true);
|
Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.