How to make 1,2,3,4 -> array(1,2,3,4)...?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
9 views
Hello.
Need to do this:
1,2,3,4 -> array(1,2,3,4) 1 2 3 4 -> array(1,2,3,4) 1\2\3\4 -> array(1,2,3,4) 1,2 3,4 -> array(1,2,3,4) 1\2 3 4 -> array(1,2,3,4)

I think it is clear shown, that is, I need to line a line with numbers which can be separated by (comma)(space)(transfer), and what would have been the combination, in a place not in place need to create an array with them.

Thank you!
by | 9 views

2 Answers

0 like 0 dislike
preg_split('/[^\\d]+/', $str)
by
0 like 0 dislike
by
110,608 questions
257,186 answers
0 comments
35,392 users