[英]How can remove the "0" and "+" from the phone number in php
必須刪除電話號碼中的“0”和“+”。 並且還需要將電話號碼變成WhatsApp鏈接。
示例:+971 561545785
Output: https://wa.me/971561545785
我試過這樣,
$國家代碼 = "+971";
$phone_number = "561545785";
$newNumber = preg_replace('/^0+?/', 'https://wa.me/'.$countryCode, $phone_number);
但這只會從中刪除零。 如何從電話號碼中刪除 0 和 + 並保存 WhatsApp 鏈接。
使用方括號內的選項
/^[0+]?/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.