所以我有一个变量$family
.
$family = "mom dad sister brother";
我必须$f
从变量中创建一个数组$family
.像这样的东西
$f = array("mom", "dad", "sister", "brother");
我接下来的事情是$nice_family = "is nice"
;
期望的结果:妈妈很好,爸爸很好,妹妹很好,兄弟很好.
提前致谢!
$family = "mom dad sister brother"; $f = explode(' ', $family); $nice = ' is nice'; echo $nice_family = implode($nice.', ' ,$f).$nice;