PHP:逐行解析数据库中的文本

I am storing a text datatype in a database that contains newlines (cr + lf). It is accessed by, for example, $row['mytext']. How can I read $row['mytext'] line by line to do some parsing prior to outputting to html? I know how to do this with a file but have never done it with text from a database.

Once you have $row['mytext'] it is just a string so you can just explode on new lines and then iterate through the array.

Example:

$string = 'line 1
line2';
foreach(explode("
", $string) as $line) {
    echo $line;
}