<?php $str = "\n\n\nABC\n\nDEF\nGHI\n\n\nJKL"; preg_match_all('~\n+|.+\n?~', $str, $matches); print_r(array_map(function($i) {return strtr($i, "\n", "#");},$matches[0]));
You have javascript disabled. You will not be able to edit any code.