I have below result from MySQL, PDO search - but I am not able to find suitable answer to make the arrays - to single array, insted of branched array.
<?php
$dataResult = array("abcdef", "People 1 - 123-456-7890
People 2 -
People 3 - Abcdef Jack
People 4 _ Defjkl Smack ");
foreach($dataResult as $result){
if(strstr($result, PHP_EOL)){
$dataResultArray[] = explode(PHP_EOL, $result);
} else {
$dataResultArray[] = $result;
}
}
print_r($dataResultArray);
I am expecting the below result, against what I get is below.
Expected:
abcdef
People 1 - 123-456-7890
People 2 -
People 3 - Abcdef Jack
People 4 _ Defjkl Smack
Output:
Array
(
[0] => abcdef
[1] => Array
(
[0] => People 1 - 123-456-7890
[1] => People 2 -
[2] => People 3 - Abcdef Jack
[3] => People 4 _ Defjkl Smack
)
)