0

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? :)

Venu
  • 7,175
  • 4
  • 37
  • 53

3 Answers3

3

Use explode()

$ids = explode(',', '0,3,4,7,8,10');
John Conde
  • 212,985
  • 98
  • 444
  • 485
0
$str = '0,3,4,7,8,10';
$arr = explode(',',$str);
SeanWM
  • 16,319
  • 7
  • 49
  • 83
0

use EXPLODE

$num = "0,3,4,7,8,10";
$pieces = explode(",", $num );
John Woo
  • 249,283
  • 65
  • 481
  • 481