Skip to content

Commit

Permalink
[9.x] Add $encoding parameter to substr method (#45300)
Browse files Browse the repository at this point in the history
* Add $encoding parameter

* Update Str.php

Co-authored-by: Taylor Otwell <taylor@laravel.com>
  • Loading branch information
mtawil and taylorotwell committed Dec 14, 2022
1 parent 1e00add commit d4e2185
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Illuminate/Support/Str.php
Expand Up @@ -1125,11 +1125,12 @@ public static function studly($value)
* @param string $string
* @param int $start
* @param int|null $length
* @param string $encoding
* @return string
*/
public static function substr($string, $start, $length = null)
public static function substr($string, $start, $length = null, $encoding = 'UTF-8')
{
return mb_substr($string, $start, $length, 'UTF-8');
return mb_substr($string, $start, $length, $encoding);
}

/**
Expand Down

0 comments on commit d4e2185

Please sign in to comment.