Multiple string in same variable

Hello forum,
I would like to know i can echo the selected mulitple string in same variable.

Here the simple.
i have string in chain.
$msg =“msg 1”;
$msg .= “msg 2”;
$msg .= “msg 3”;

but want to just echo the first two string
in echo statement.

echo $msg;
will show me all those three but i just want to echo the first two.

any tip or advice.

Thanks,
Sam

i dont think i understand what you mean but will this do

$msg="msg1";
$msg2="msg2";
$msg3="msg3";
print "$msg.$msg2";

hope this helps

Or you could store them in an array:


$msg = array();
$msg[1] = 'msg 1';
$msg[2] = 'msg 2';
$msg[3] = 'msg 3';

echo $msg[1];

thx for the reply guys.

i trying to mod the shopping card script.

here the code…
this is check_out.php
$payment_info_details = $db_payment->f(“payment_method_name”);
if( !empty( $_SESSION[‘ccdata’][‘order_payment_name’] )
&& !empty($SESSION[‘ccdata’][‘order_payment_number’])) {
$payment_info_details .= ‘<br />’.$VM_LANG->
(‘PHPSHOP_CHECKOUT_CONF_PAYINFO_NAMECARD’,false).': ‘.$SESSION[‘ccdata’][‘order_payment_name’].‘<br />’;
$payment_info_details .= $VM_LANG->
(‘PHPSHOP_CHECKOUT_CONF_PAYINFO_CCNUM’,false).’: ‘.$this->asterisk_pad($SESSION[‘ccdata’][‘order_payment_number’], 4 ).‘<br />’;
$payment_info_details .= $VM_LANG->
(‘PHPSHOP_CHECKOUT_CONF_PAYINFO_EXDATE’,false).’: ’
.date(‘m / y ‘, $SESSION[‘ccdata’][‘order_payment_expire’]) .‘<br />’;
//$payment_info_details .= $VM_LANG->
(‘PHPSHOP_CHECKOUT_CONF_PAYINFO_EXDATE’,false).’: ‘.$_SESSION[‘ccdata’][‘order_payment_expire_month’].’ / ‘.$_SESSION[‘ccdata’][‘order_payment_expire_year’].’<br />’;
if( !empty($_SESSION[‘ccdata’][‘credit_card_code’])) {
$payment_info_details .= ‘CVV code: ‘.$_SESSION[‘ccdata’][‘credit_card_code’].’<br />’;
}
}

As you see, var $payment_info_details are in chain string.

Then, stored and display “echo $payment_info_details” on the confirmation.tpl.php then email to the customer.

So, i just want to echo just the selected info.

I know i can take out the var in check_out.php but i wanted make change code in confirmation.tpl.php.

the “$msg” was just the simple to see any solution.

Thanks,
Sam