在php中,我想从多个单词块中获得尽可能多的不同句子。 例如我放入PHP代码:
"today" "yesturday" | "is" "is not" | "monday" "tuesday"
It would become:
today is monday
yesturday is monday
today is not tuesday
yesturday is tuesday
etc...
我怎么能在PHP中创建这个?
谢谢。
发布于 2018-08-22 15:45:26
试试这个。
$block1 = array("today", "yesturday" );
$block2 = array("is", "is not");
$block3 = array("monday", "tuesday");
foreach($block1 as $word1) {
foreach($block2 as $word2) {
foreach($block3 as $word3) {
echo $word1.' '.$word2.' '.$word3."\n";
}
}
}
https://stackoverflow.com/questions/-100002353
复制相似问题