Using regex to eliminate blank lines before exploding (works well for any number of consecutive blank lines, also see next snippet):
$text = preg_replace('/
+/', "
", trim($_POST['textarea']));
Splitting with a regex:
$lines = preg_split('/
+/', trim($_POST['textarea']));
$text = implode("
", $lines);
Splitting without a regex:
$lines = array_filter(explode("
", trim($_POST['textarea'])));
$text = implode("
", $lines);
Just feeling a tad creative today, pick your poison :)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…