如何删除“ 0”。 &&quot”从PHP中的电话号码
必须删除电话号码的“ 0”和“+”。而且还需要将电话号码转换为WhatsApp链接。
示例:+971 561545785
https://wa.me/971561545785 =“ +971”;
$ phone_number =“ 561545785”;
$ newnumber = preg_replace('/^0+?/',',' $ phone_number);
但这只会从中删除零。如何从电话号码中删除0和 + +并保存WhatsApp链接。
The "0" and "+" from the phone number must be removed. And also need to turn the phone number into a WhatsApp link.
Example : +971 561545785
Output : https://wa.me/971561545785
i have tried like this,
$countryCode = "+971";
$phone_number = "561545785";
$newNumber = preg_replace('/^0+?/', 'https://wa.me/'.$countryCode,
$phone_number);
But this only removing the zero from. how can i remove 0 and + from phone number and save a WhatsApp link.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在方括号内使用选项
Use options inside square brackets