我需要有关如何连接 phone 数字并在开头添加 +234 并且仍然用逗号与以下数字分开的帮助
Please i need help on how to concatenate phone numbers and add +234 at the beginning and still separte with comma from the following one
<?php
$phonenumber = 090254,090906,081343;
session_start();
$phonenumbers = $_SESSION['phonenumber'];
$arrayName = array($phonenumbers);
so please how can i add +234 to phonenumbers been moved in to the next page and still separate the next one number from the other with a comma.
foreach ($arrayName as $key) {
$user_status = explode(",", $key);
//print_r($user_status);
}
$i = 1;
$total_phone_num = count($user_status);
$before_last = $total_phone_num - 1;
$valid_phone_num = "'";
foreach ( $user_status as $valid_phone){
if ($i <= $before_last){
$valid_phone_num = $valid_phone_num."+234".$valid_phone.",";
}else{
$valid_phone_num = $valid_phone_num."+234".$valid_phone."'";
}
$i = $i + 1;
}
echo $valid_phone_num;
我终于找到答案了
output '+23409025741418,+23409090806070,+2340808345525'
<?php
$phonenumber = 090254,090906,081343;
session_start();
$phonenumbers = $_SESSION['phonenumber'];
$arrayName = array($phonenumbers);
so please how can i add +234 to phonenumbers been moved in to the next page and still separate the next one number from the other with a comma.
foreach ($arrayName as $key) {
$user_status = explode(",", $key);
//print_r($user_status);
}
$i = 1;
$total_phone_num = count($user_status);
$before_last = $total_phone_num - 1;
$valid_phone_num = "'";
foreach ( $user_status as $valid_phone){
if ($i <= $before_last){
$valid_phone_num = $valid_phone_num."+234".$valid_phone.",";
}else{
$valid_phone_num = $valid_phone_num."+234".$valid_phone."'";
}
$i = $i + 1;
}
echo $valid_phone_num;
我终于找到答案了
output '+23409025741418,+23409090806070,+2340808345525'