0

I have this code ->

<?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','');

?>

I want to add to $selectdata->title=JText::_('BLA_BLA_BLA');

this code echo count($this->savedlist)

so what I want to achieve is something like ->

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

It doesn't work like $selectdata->title=JText::_('BLA_BLA_BLA') . echo count($this->savedlist); , can somebody PLEASE help me, how can I add the "count" code near the "BLA_BLA_BLA" text..?

Thank you

1 Answer 1

1

You cannot use echo inside string concatenation. echo will output string, and you wan't to assign function return value to another variable.

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.