如何从长字符串中获取分隔的整数 [英] How to grab seperated integers from long string

查看:73
本文介绍了如何从长字符串中获取分隔的整数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为柔道俱乐部开设招生系统。我正在使用一个字符串来存储出现的人的ID。它看起来像这样:

I am working on a enrollment system for a judo club. I am using a string to store the ID's of people, who showed up. It looks somthing like this:

0,3,4,7,8,10,

0,3,4,7,8,10,

现在,我想在PHP中将每个数字分成一个整数数组。对此最简单的解决方案是什么? :)

Now, I want to seperate each number into an integer array in PHP. What would the simplest solution to this be? :)

推荐答案

使用 explode()

$ids = explode(',', '0,3,4,7,8,10');

这篇关于如何从长字符串中获取分隔的整数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆