php - Can't get rid of /r/n -


i explored previous questions , solutions, nut none of them works in situation.

i have input text area accepts employee ids. end users use comma , enter, space separate multiple employee ids, , need change separation commas.

this code:

$emplids = preg_replace('/[,\t\n\r\s]+/',",",$emplids); 

and then, need keep numbers , commas:

$emplids = preg_replace("/[^x0-9,]/", "", $emplids); 

and need store them anarray:

$emplids = explode(",", $emplids); 

now end users put comma among employee ids work, line breaks not work.

i tried double quotas:

$emplids = preg_replace("/[,\t\n\r\s]+/",",",$emplids); 

it doesn't work neither.

it seems tiny question, takes me hours. , hints highly appreciated!

or can ids rule 1 id can contain digits, nothing else.

$input = <<<eof 123 356 353,255 2424,535 35 eof;  preg_match_all('/(\d+)/',$input, $matches); print_r($matches[1]); 

Comments