This my array which contains employee role details, department details and permission details.
Array
(
[0] => stdClass Object
(
[role_id] => 3
[role_name] => team leader
[role_description] => Competently brand orthogonal e-tailers vis-a-vis just in time manufactured products. Interactively extend performance based relationships for ubiquitous total linkage. Collaboratively fabricate stand-alone customer service whereas flexible growth strategies. Assertively harness fully tested e-market
[role_department_id] => 2
[department_id] => 2
[department_name] => brand centrical
[department_description] => Distinctively implement turnkey action items without distributed e-business. Globally visualize reliable core competencies via optimal imperatives. Seamlessly revolutionize standards compliant partnerships rather than functionalized convergence. Intrinsicly expedite intuitive functionalities after frictionless e-services. Seamlessly impact user-centric core competencies for resource sucking processes.
[user_role_permission_id] => 13
[user_permission_id] => 9
[permission] => employee
[permission_page] => newemployee
)
[1] => stdClass Object
(
[role_id] => 3
[role_name] => team leader
[role_description] => Competently brand orthogonal e-tailers vis-a-vis just in time manufactured products. Interactively extend performance based relationships for ubiquitous total linkage. Collaboratively fabricate stand-alone customer service whereas flexible growth strategies. Assertively harness fully tested e-market
[role_department_id] => 2
[department_id] => 2
[department_name] => brand centrical
[department_description] => Distinctively implement turnkey action items without distributed e-business. Globally visualize reliable core competencies via optimal imperatives. Seamlessly revolutionize standards compliant partnerships rather than functionalized convergence. Intrinsicly expedite intuitive functionalities after frictionless e-services. Seamlessly impact user-centric core competencies for resource sucking processes.
[user_role_permission_id] => 15
[user_permission_id] => 11
[permission] => employee
[permission_page] => edit
)
[2] => stdClass Object
(
[role_id] => 3
[role_name] => team leader
[role_description] => Competently brand orthogonal e-tailers vis-a-vis just in time manufactured products. Interactively extend performance based relationships for ubiquitous total linkage. Collaboratively fabricate stand-alone customer service whereas flexible growth strategies. Assertively harness fully tested e-market
[role_department_id] => 2
[department_id] => 2
[department_name] => brand centrical
[department_description] => Distinctively implement turnkey action items without distributed e-business. Globally visualize reliable core competencies via optimal imperatives. Seamlessly revolutionize standards compliant partnerships rather than functionalized convergence. Intrinsicly expedite intuitive functionalities after frictionless e-services. Seamlessly impact user-centric core competencies for resource sucking processes.
[user_role_permission_id] => 16
[user_permission_id] => 12
[permission] => employee
[permission_page] => update
)
[3] => stdClass Object
(
[role_id] => 3
[role_name] => team leader
[role_description] => Competently brand orthogonal e-tailers vis-a-vis just in time manufactured products. Interactively extend performance based relationships for ubiquitous total linkage. Collaboratively fabricate stand-alone customer service whereas flexible growth strategies. Assertively harness fully tested e-market
[role_department_id] => 2
[department_id] => 2
[department_name] => brand centrical
[department_description] => Distinctively implement turnkey action items without distributed e-business. Globally visualize reliable core competencies via optimal imperatives. Seamlessly revolutionize standards compliant partnerships rather than functionalized convergence. Intrinsicly expedite intuitive functionalities after frictionless e-services. Seamlessly impact user-centric core competencies for resource sucking processes.
[user_role_permission_id] => 6
[user_permission_id] => 16
[permission] => suggestion
[permission_page] => view
)
[4] => stdClass Object
(
[role_id] => 3
[role_name] => team leader
[role_description] => Competently brand orthogonal e-tailers vis-a-vis just in time manufactured products. Interactively extend performance based relationships for ubiquitous total linkage. Collaboratively fabricate stand-alone customer service whereas flexible growth strategies. Assertively harness fully tested e-market
[role_department_id] => 2
[department_id] => 2
[department_name] => brand centrical
[department_description] => Distinctively implement turnkey action items without distributed e-business. Globally visualize reliable core competencies via optimal imperatives. Seamlessly revolutionize standards compliant partnerships rather than functionalized convergence. Intrinsicly expedite intuitive functionalities after frictionless e-services. Seamlessly impact user-centric core competencies for resource sucking processes.
[user_role_permission_id] => 7
[user_permission_id] => 18
[permission] => evaluation
[permission_page] => index
)
[5] => stdClass Object
(
[role_id] => 3
[role_name] => team leader
[role_description] => Competently brand orthogonal e-tailers vis-a-vis just in time manufactured products. Interactively extend performance based relationships for ubiquitous total linkage. Collaboratively fabricate stand-alone customer service whereas flexible growth strategies. Assertively harness fully tested e-market
[role_department_id] => 2
[department_id] => 2
[department_name] => brand centrical
[department_description] => Distinctively implement turnkey action items without distributed e-business. Globally visualize reliable core competencies via optimal imperatives. Seamlessly revolutionize standards compliant partnerships rather than functionalized convergence. Intrinsicly expedite intuitive functionalities after frictionless e-services. Seamlessly impact user-centric core competencies for resource sucking processes.
[user_role_permission_id] => 9
[user_permission_id] => 25
[permission] => leave
[permission_page] => newrequest
)
[6] => stdClass Object
(
[role_id] => 3
[role_name] => team leader
[role_description] => Competently brand orthogonal e-tailers vis-a-vis just in time manufactured products. Interactively extend performance based relationships for ubiquitous total linkage. Collaboratively fabricate stand-alone customer service whereas flexible growth strategies. Assertively harness fully tested e-market
[role_department_id] => 2
[department_id] => 2
[department_name] => brand centrical
[department_description] => Distinctively implement turnkey action items without distributed e-business. Globally visualize reliable core competencies via optimal imperatives. Seamlessly revolutionize standards compliant partnerships rather than functionalized convergence. Intrinsicly expedite intuitive functionalities after frictionless e-services. Seamlessly impact user-centric core competencies for resource sucking processes.
[user_role_permission_id] => 10
[user_permission_id] => 26
[permission] => leave
[permission_page] => create
)
[7] => stdClass Object
(
[role_id] => 3
[role_name] => team leader
[role_description] => Competently brand orthogonal e-tailers vis-a-vis just in time manufactured products. Interactively extend performance based relationships for ubiquitous total linkage. Collaboratively fabricate stand-alone customer service whereas flexible growth strategies. Assertively harness fully tested e-market
[role_department_id] => 2
[department_id] => 2
[department_name] => brand centrical
[department_description] => Distinctively implement turnkey action items without distributed e-business. Globally visualize reliable core competencies via optimal imperatives. Seamlessly revolutionize standards compliant partnerships rather than functionalized convergence. Intrinsicly expedite intuitive functionalities after frictionless e-services. Seamlessly impact user-centric core competencies for resource sucking processes.
[user_role_permission_id] => 17
[user_permission_id] => 27
[permission] => leave
[permission_page] => viewall
)
[8] => stdClass Object
(
[role_id] => 3
[role_name] => team leader
[role_description] => Competently brand orthogonal e-tailers vis-a-vis just in time manufactured products. Interactively extend performance based relationships for ubiquitous total linkage. Collaboratively fabricate stand-alone customer service whereas flexible growth strategies. Assertively harness fully tested e-market
[role_department_id] => 2
[department_id] => 2
[department_name] => brand centrical
[department_description] => Distinctively implement turnkey action items without distributed e-business. Globally visualize reliable core competencies via optimal imperatives. Seamlessly revolutionize standards compliant partnerships rather than functionalized convergence. Intrinsicly expedite intuitive functionalities after frictionless e-services. Seamlessly impact user-centric core competencies for resource sucking processes.
[user_role_permission_id] => 11
[user_permission_id] => 28
[permission] => leave
[permission_page] => response
)
)
In the above code block you can see [permission] => employee is same for [0],[1],[2] arrays too. But [permission_page] is different. So, I want a multidimensional array like shown below. Here, [permission] array contains all the [permission_page]. I want to implement my code in a similar fashion as shown below. Any help would be much appreciated.
Array
(
[employee] => Array
(
[0] => newemployee
[1] => edit
[2] => update
)
[suggestion] => Array
(
[0] => view
)
[evaluation] => Array
(
[0] => index
)
[leave] => Array
(
[0] => newrequest
[1] => create
[2] => viewall
[3] => response
)
)