2013-02-25 61 views
0

我有这样的代码 - >PHP添加两个选项变量

<?php 

$savearray = $this->savedlist; 
$selectdata = new stdClass; 
$selectdata->id=''; 
$selectdata->title=JText::_('BLA_BLA_BLA'); 
array_push($savearray, $selectdata); 
$savearray = array_reverse($savearray); 
echo JHTML::_('select.genericlist',$savearray,'savedlist','class="inputbox"','id','title',''); 

?> 

我想要添加到$selectdata->title=JText::_('BLA_BLA_BLA');

这个代码echo count($this->savedlist)

,所以我想达到的目标是一样的东西 - >

$selectdata->title=JText::_('BLA_BLA_BLA') . echo count($this->savedlist); 

它不像$selectdata->title=JText::_('BLA_BLA_BLA') . echo count($this->savedlist);,ca ñ有人请帮助我,我怎么可以在“BLA_BLA_BLA”文本附近添加“计数”代码..?

谢谢

回答

1

不能使用echo内字符串连接。 echo将输出字符串,并且您不想将函数返回值分配给另一个变量。

$selectdata->title = JText::_('BLA_BLA_BLA') . count($this->savedlist);

+0

谢谢。有效 :) – Vzlotea 2013-02-25 10:01:06