[Solved] PHP: Breaking a string into multiple lines and manipulating each line separately [closed]


Simply use the explode() function with PHP_EOL constant as delimiter:

$lines = explode(PHP_EOL, $original);

After you can iterate the returned array to parse lines, for example:

foreach ( $lines as $line )
{
    echo '<span>'.$line.'</span>';
}

3

solved PHP: Breaking a string into multiple lines and manipulating each line separately [closed]