1.2.1647. mb_strrpos() Third Argument

Passing the encoding as 3rd parameter to mb_strrpos() is deprecated. Instead pass a 0 offset, and encoding as 4th parameter.

<?php

// Finds the position of the last occurrence of of a string in a string, starting at position 10
$extract = mb_strrpos($haystack, $needle, 10, 'utf8');

// This is the old behavior. Here, the offset will be 0, by default
$extract = mb_strrpos($haystack, $needle, 'utf8');
?>

See also mb_strrpos().

1.2.1647.1. Suggestions

  • Remove usage of mb_strrpos() 3rd parameter.

1.2.1647.2. Specs

Short name

Php/Php74mbstrrpos3rdArg

Rulesets

All, CE, Changed Behavior, CompatibilityPHP74

Exakat since

1.8.9

PHP Version

All

Severity

Minor

Time To Fix

Quick (30 mins)

Changed Behavior

PHP 8.0

Precision

Very high

Available in

Entreprise Edition, Community Edition, Exakat Cloud