How to grab seperated integers from long string
问题 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, Now, I want to seperate each number into an integer array in PHP. What would the simplest solution to this be? :) 回答1: Use explode() $ids = explode(',', '0,3,4,7,8,10'); 回答2: $str = '0,3,4,7,8,10'; $arr = explode(',',$str); 回答3: use EXPLODE $num = "0,3,4,7,8,10"; $pieces = explode(",", $num ); Explode Manual 来源: https://stackoverflow