如何无序播放&;回显2行中的随机单词


How to Shuffle & Echo 2 Random word from 2 lines?

如何无序排列&从2行中回显2个随机单词?

示例我的代码

$lines1 = "one, two, three, four, five"; 
$lines2 = "aa, bb, cc, dd, ee"; 
$array=explode(",",$lines1, $lines2);  
shuffle($array);  
$newstring = implode($array,""); 
echo substr($newstring, 0, 1);

$lines1 $lines2原始字符串

来自line1line2 的2个字的回声选择性混洗

我想要这种

two这个词来自line1

dd这个词来自line2

输出two ddee three

只需将这两行分解为seprate数组,然后对它们进行混洗。类似这样的东西:

$lines1 = "one, two, three, four, five"; 
$lines2 = "aa, bb, cc, dd, ee"; 
$array1 = explode(",", $lines1);  
shuffle($array1);  
$array2 = explode(",", $lines2);  
shuffle($array2);  
echo $array1[0] ." ". $array2[0];