i have the following array:
$datos = array(
"TIMESTAMP" => $timestamp,
"AMOUNT" => $amount,
"ORDER_ID" => $Order,
"SHA1HASH" => $firma,
"MERCHANT_ID" => $MerchantID,
"AUTO_SETTLE_FLAG" => '0',
"CURRENCY" => 'EUR',
"DCC_ENABLE" => '0',
"HPP_VERSION" => '2',
"HPP_CHANNEL" => 'ECOM',
"HPP_LANG"=> $_POST['lang'],
"HPP_CUSTOMER_EMAIL"=> $_POST['email'],
"HPP_CUSTOMER_PHONENUMBER_MOBILE"=> $_POST['tel']
);
I need to add to the "HPP_CUSTOMER_PHONENUMBER_MOBILE" value another value provided by POST method called 'pretel' with a "|" sign in between the pretel and the tel value, so for example if someone send trought the form pretel "34" and tel "600111222" the result would be: 34|600111222, i tryed the following code but not working:
"HPP_CUSTOMER_PHONENUMBER_MOBILE"=> $_POST['pretel'] '|' $_POST['tel']
CodePudding user response:
In PHP concatenation is done via .
operator
So do like below:
"HPP_CUSTOMER_PHONENUMBER_MOBILE"=> $_POST['pretel']."|".$_POST['tel']
Note:
is used as a concatenation operator in javascript/jQuery.
In PHP
is used to add numbers or combine arrays as well
CodePudding user response:
You can write that variable as below
"HPP_CUSTOMER_PHONENUMBER_MOBILE"=> $_POST['pretel']." | ".$_POST['tel']
You can adjust space before and after " | " as per your need.