By John Koster
The length
helper method simply returns the length of the given $value
, using PHP's internal character encoding.
The signature for the length
helper method is:
length($value)
1use Illuminate\Support\Str;
2
3// 5
4echo Str::length('12345');
5
6// 120
7echo Str::length(str_repeat('n', 120));
#str_repeat($input, $multiplier)
str_repeat
is a function built into PHP that repeats a given $input
$multiplier
number of times. So calling str_repeat('n', 120)
results in a string containing 120 occurrences of the character n
.
∎