Hi,
I am creating a SMS app the following code is supposed to:
check if the mobile/cell number is 11 characters long.
check if the number starts with 07.
If neither of these conditions are met, it should remove the number from the array.
So the following numbers would be valid:
07123456789,07123456790,07123456791,07123456792,07123456793,07123456794
However the following wouldn't (and need to be removed):
0801458,07855488,6695522214124514
$param["number"] = "07123456789,07123456790,07123456791,07123456792,07123456793,07123456794,0801458,07855488,6695522214124514";
$number = explode(',', $param["number"]);
foreach($number as $num){
if (!substr_compare($num, "07", 0, 3, false)) {
unset($num);
}
elseif (substr_compare($num, "07", 0, 3, true)) {
if(strlen($num) == 11) {
$li .= "447" . substr($num, 2) . ',';
}
}
}
$il .= substr($li, 0, strlen($li)-1);
echo $il;
// $request = substr($request, 0, strlen($request)-1);
// return $n;
}
I also need to remove the final comma from the result.
Any help will be appriciated.
Thanks,
Kyle