I am trying to change the output from $foo, replace linebreaks with ";". Here is an explanation and my preg match, however it does not work. The output is the same
<?php
/* $foo
1554
6554
5543
*/
preg_replace('/^\s+|
||\s+$/m', ';', $foo);
# What I want: $foo = '1554;6554;5543'
?>
Does anyone know a preg replace I can use or any other method for doing this? These numbers are in a textarea, one number at each line.