• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to concatenate variables?

#1
[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?

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

#3
[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;


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.