str_pad
symfony/var-dumper
Supported Versions: PHP 4 >= 4.0.1, PHP 5, PHP 7, PHP 8
Pad a string to a certain length with another string
str_pad
(
string $string
,
int $length
,
string $pad_string
=
" "
,
int $pad_type
=
STR_PAD_RIGHT
):
string
private static function
formatSeconds
(
string $s
,
string $us
):
string
{
return
sprintf
(
'%02d.%s'
,
$s
,
0
=== (
$len
=
\strlen
(
$t
=
rtrim
(
$us
,
'0'
))) ?
'0'
: (
$len
<=
3
?
str_pad
(
$t
,
3
,
'0'
) :
$us
));
}
}
Caster/DateCaster.php