Skip to content
Advertisement

how to convert this Associative array into another form in PHP?

hey I’m using PHP and I have this array called $memdeps

JavaScript

and I want to convert it to a form where the dep_id key contains all the related member_id’s

the wanted result is like that form

JavaScript

and the actually wanted result is like that

JavaScript

I tried that code

JavaScript

and it’s not working , and I don’t know how to be able to do it

Advertisement

Answer

Here is the solution

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement