CodeIgniter Forums
How to concatenate variables? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: How to concatenate variables? (/showthread.php?tid=26250)



How to concatenate variables? - El Forum - 01-09-2010

[eluser]shinokada[/eluser]
The original code it this.
Code:
switch ($updated){
    case 0:
    $string = $this->lang->line('orders_no_records');
    break;
        
    case 1:
    $string = "$updated record";
    break;
            
    default:
    $string = "$updated records";
    break;
...
...

Now I want to use language class and concatnate it. For example the last one.

Code:
default:
$records = $this->lang->line('orders_records');
$string = "$updated "."$records";
bread;

Is this the correct way to do it?


How to concatenate variables? - El Forum - 01-09-2010

[eluser]n0xie[/eluser]
Code:
$string = $updated . $this->lang->line('orders_records');



How to concatenate variables? - El Forum - 01-09-2010

[eluser]gigas10[/eluser]
Kind of, you do not need to put quotations around variables. Try this:
Code:
default:
$records = $this->lang->line('orders_records');
$string = $updated . " " . $records;
bread;