I have tried several solutions to replace a , with aeither <br /> or \n\r
To no avail I am left stuck and wondering if the wonderful users of SO could lend a hand.
$row['address'] = 'Unit A, 64 Alert Square, London, E16';
echo "Address: ". nl2br(str_replace(',',' \r\n ', $row['address']));
result: Unit A \r\n 64 \r\n Alert \r\n Square \r\n London \r\n E16
needed, well, desired effect:
Unit A
64 Alert Square
London
E16
Character escapes like
\rand\nneed to be double quotes or heredocs to be understood by PHP, e.g.:echo "Address: ". nl2br(str_replace(',', "\n", $row['address']));