I have a problem with the deleting of next line empty data using laravel. Where did I go wrong?
I tried using this code explode, str_replace and array_map but still i don't get want i want.
$string = str_replace(array("\r", "\n"), "\n", $tempData[0]);
$your_arrays = array_map("trim", explode("\n", $string));
print_r ($your_arrays);
Array
(
[0] =>
[1] =>
[2] => Sample Text1
[3] =>
[4] => Sample text 2
[5] => Sample Text 3
[6] =>
[7] =>
[8] => Sample Text 4
[9] => Sample Text 5
[10] => Sample Text 6
[11] => Sample Text 7
[12] => Sample Text 8
[13] =>
[14] =>
[15] =>
)
I'm expecting the result with this
Array
(
[1] => Sample Text1
[2] => Sample text 2
[3] => Sample Text 3
[4] => Sample Text 4
[5] => Sample Text 5
[6] => Sample Text 6
[7] => Sample Text 7
[8] => Sample Text 8
)