<?php
$this->data['cumle'] = 'Bizim evdə 3 mühasib yeddi müəllim var';
$c = str_word_count($this->data['cumle'], 0,"əöüçşğıÜÖĞIƏŞ123456780");
for($k = 0;$k<$c;$k++){
$this->data['word'] = explode(" ",$this->data['cumle']);
$this->data['suallar'] = $this->Welcome->questions($this->data['word'][$k]);
foreach ($this->data['suallar'] as $key => $this->data['sual']) {
extract($this->data['sual']);
$this->data['model'] = $a_sual."+";
}
?>
我希望将$this->data['model']
作为for()
和foreach()
中的1个文本。
大约,它会得到“谁+什么+为什么+当+ +”值。
非常感谢。
答案 0 :(得分:2)
您可能只需要更改以下行...
$this->data['model'] = $a_sual."+";
因为这只是覆盖了以前的值,所以将=
更改为.=
以将新部分添加到现有值...
$this->data['model'] .= $a_sual."+";
最好在循环之前清除它以阻止其中包含先前的值(如果有的话)......
$this->data['model'] ='';