あなたは、これが試行してFrayneよりも驚くほど速く機能(〜20%高速化)を探している場合:
function ManipulateStr($input)
{
return implode(
' ', // Re-join string with spaces
array_map(
function($v)
{
// UC the first and last chars and concat onto middle of string
return strtoupper(substr($v, 0, 1)).
substr($v, 1, (strlen($v) - 2)).
strtoupper(substr($v, -1, 1));
},
// Split the input in spaces
// Map to anonymous function for UC'ing each word
explode(' ', $input)
)
);
// If you want the middle part to be lower-case then use this
return implode(
' ', // Re-join string with spaces
array_map(
function($v)
{
// UC the first and last chars and concat onto LC'ed middle of string
return strtoupper(substr($v, 0, 1)).
strtolower(substr($v, 1, (strlen($v) - 2))).
strtoupper(substr($v, -1, 1));
},
// Split the input in spaces
// Map to anonymous function for UC'ing each word
explode(' ', $input)
)
);
}
'ucwords(strrev(ucwordsを返します – splash58
あなたの希望する出力をお願いします.. –
@FrayneKonok - それは質問にあります。 '出力:HellO MY FriendS ' – j08691