I've been stuck on this issue for a while now. I have a multidimensional array that I'd like to output in a certain way. Here is the array:
array:3 [
"First Name" => array:3 [
0 => "BILLY"
1 => "SALLY"
2 => "TYLER"
]
"Last Name" => array:3 [
0 => "RAY"
1 => "SUE"
2 => "TERRIER"
]
"HOBBY" => array:3 [
0 => "PIANO"
1 => "SKATING"
2 => "BASKETBALL"
]
]
I'd like to have the final output be the following:
BILLY|RAY|PIANO|
SALLY|SUE|SKATING|
TYLER|TERRIER|BASKETBALL|
Unfortunately with the existing code I have:
$output = '';
foreach($tempArray as $key => $value){
$output .= $value[array_search($key,$tempArray)].$delimiter;
}
it only outputs the first index of each array like so:
BILLY|RAY|PIANO|
So my question is how do I end up with the remaining two values? Should I create some sort or array and counter and and store each output this way: $newArray[$counter] = $output?
