php 子字符串删除?
我的数据库中有一个游戏 IP,如下所示:"271.29.248.23:27912"
我希望子字符串采用最后 5 个数字“27912
”,并且我还想删除 “:”
。 这可能吗?有人可以帮助我吗?
如果可能的话,我希望数字是这样的,这样会更容易...
$ip = "271.29.248.23";
$port = "27912";
请帮助我,我需要这个脚本:(
I have an game ip in my database, like so: "271.29.248.23:27912"
I want the substring to take the last 5 numbers "27912
" and also i want to delete the ":"
.
Is that possible and could someone help me?
And if possible i would like the numbers to be like this so it would be easier...
$ip = "271.29.248.23";
$port = "27912";
Please help me, i need this for a script :(
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您还可以使用 parse_url,它将处理更多情况
:
You could also use parse_url, which will handle more cases:
Prints: