[ create a new paste ] login | about

Link: http://codepad.org/Fp367H1f    [ raw code | output | fork ]

PHP, pasted on Mar 24:
1
2
3
4
5
6
7
<?php

$str = "a,b c,d;e f";

$pieces = preg_split('/[, ;]/', $str);

var_dump($pieces);


Output:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
array(6) {
  [0]=>
  string(1) "a"
  [1]=>
  string(1) "b"
  [2]=>
  string(1) "c"
  [3]=>
  string(1) "d"
  [4]=>
  string(1) "e"
  [5]=>
  string(1) "f"
}


Create a new paste based on this one


Comments: