Hello. Sorry if this has been addressed before, but I did search and try figure this out. My last resort is always opening a new thread....
I have the following multidimensional array :
Array
(
[0] => Array
(
[id] => 1
[fullname] => Test Contact 1
[email] => tc1@email.com
[type] => Technical Contact
)
[1] => Array
(
[id] => 24
[fullname] => Test Contact 2
[email] => tc2@email.com
[type] => Technical Contact
)
[2] => Array
(
[id] => 25
[fullname] => Test Contact 3
[email] => tc3@email.com
[type] => Billing Contact
)
[3] => Array
(
[id] => 29
[fullname] => Test Contact 4
[email] => tc4@email.com
[type] => Billing Contact
)
[4] => Array
(
[id] => 37
[fullname] => Test Contact 5
[email] => tc5@email.com
[type] => Billing Contact
)
)
What I want to do is get each of the same [type] of contact into a single variable so I can echo the variable.
In other words, for each of the [type] => Billing Contact above (there are 3), and each of the [type] => Technical Contact above (there are 2) I want to concatenate all the other values into a single variable like this:
$billing_contact
$technical_contact
I then want to be able to simply echo this variable:
echo $billing_contact;
Which I then want to show some html like this
Test Contact 3<br />
tc3@email.com<br /><br />
Test Contact 4<br />
tc4@email.com<br /><br />
Test Contact 5<br />
tc5@email.com<br /><br />
So the output to the screen looks like this:
Test Contact 3
tc3@email.com
Test Contact 4
tc4@email.com
Test Contact 5
tc5@email.com
I've been trying all sorts of foreach loops and concatenate to try get things into the single variable format I need, but i'm stuck...
I have to get the full set of results for all the same [type] values into a single variable because I use str_replace when rendering the output.
The system is using a homegrown template type system, which means I look for {$billing_contacts} in PHP and simply replace {$billing_contacts} with $billing_contacts
I then echo $billing_contacts and want to get the list as mentioned.
I hope I have not confused anyone, but please try give me a hand since this is driving me nuts!
Thank you in advance for your time and help.