substr_replace
laravel/framework
Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Replace text within a portion of a string
substr_replace
(
array
|
string $string
,
array
|
string $replace
,
array
|
int $offset
,
array
|
int
|
null $length
=
null
):
string
|array
public function
__invoke
(
$string
)
{
if (
str
(
$string
)->
endsWith
([
'.'
,
'?'
,
'!'
,
':'
])) {
return
substr_replace
(
$string
,
''
, -
1
);
}
return
$string
;
src/Illuminate/Console/View/Components/Mutators/EnsureNoPunctuation.php
$position
=
strpos
(
$subject
,
$search
);
if (
$position
!==
false
) {
return
substr_replace
(
$subject
,
$replace
,
$position
,
strlen
(
$search
));
}
return
$subject
;
src/Illuminate/Support/Str.php
$position
=
strrpos
(
$subject
,
$search
);
if (
$position
!==
false
) {
return
substr_replace
(
$subject
,
$replace
,
$position
,
strlen
(
$search
));
}
return
$subject
;
src/Illuminate/Support/Str.php
$length
=
strlen
(
$string
);
}
return
substr_replace
(
$string
,
$replace
,
$offset
,
$length
);
}
src/Illuminate/Support/Str.php
public function
__toString
()
{
return
substr_replace
(
$this
->
value
,
'.'
, -
$this
->
scale
,
0
);
}
}
tests/Integration/Database/DatabaseEloquentModelCustomCastingTest.php