转换为小写并连接

Convert to lowercase and concatenate

什么是转换为小写并连接的最佳选择?

$first      = "Abc Def";
$second= "Ghi Jkl";
$result= $first.$second;    

预期输出: abcdef.ghijkl

strtolower 转换为小写

$first = str_replace(' ','',strtolower("Abc Def"));
$second= str_replace(' ','',strtolower("Ghi Jkl"));
$result= $first.$second;    

使用strtolower转换小写,str_replace删除space。 最后加入两个变量并在它们之间添加一个'.'

$first      = "Abc Def";
$second= "Ghi Jkl";

$low_first = strtolower(str_replace(" ","",$first));
$low_second = strtolower(str_replace(" ","",$second));
echo $finalresult = $low_first.'.'.$low_second;

输出

abcdef.ghijkl

希望这个最简单的也能有所帮助。这里我们使用多个函数 implodestr_replacestrtolower

Try this code snippet here

<?php
ini_set('display_errors', 1);

$first = "Abc Def";
$second = "Ghi Jkl";

echo strtolower(str_replace(" ","",implode(".", array($first,$second))));

输出: abcdef.ghijkl