php为变量添加了两个选项


php add two options to variable

我有这个代码->

<?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);那样工作,有人能帮我吗?我如何在"BLA_BLA_BLA"文本附近添加"计数"代码。。?

感谢

不能在字符串串联中使用echoecho将输出字符串,并且您不希望将函数返回值分配给另一个变量。

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