Код: Выделить всё
$role = array (
'Dashboard' => null,
'Students' => array (
'Admission' => array (
0 => 'Entry',
1 => 'Review',
2 => 'Approved/Reject'
),
'Search' => null,
'AdvanceSearch' => null,
'Courses' => null
),
'HR' => array (
'Settings' => null
),
'Employee Management' => array (
0 => 'Entry',
1 => 'Association',
2 => 'Search'
),
'Employee Attendance' => null,
'Payroll' => array (
0 => 'Generate Pay Slip',
1 => 'Payroll Run',
2 => 'Payroll Revert',
3 => 'View Pay Slips'
),
'Finance' => null,
'More' => null
);
[img]https: //i.sstatic.net/l2xW6.png[/img]
Я пытаюсь сделать это с помощью рекурсии, но не могу этого сделать, поскольку DIV не закрыт должным образом.
Вот код, который я пытаюсь использовать мой html:
Код: Выделить всё
$child = 0;
function RecursiveWrite($array, $child ) {
$parent_array_size = count($array);
foreach ($array as $key => $vals) {
if(is_array($vals)){
$inner_array_size = count($vals);
echo " ".$key." ";
RecursiveWrite($vals,$child);
}else{
$child = 0;
if(is_numeric($key)){
echo " ".$vals." ";
}else{
echo " ".$key." ";
}
}
//
}
}
RecursiveWrite($role, $child);
Как я могу это получить?
Подробнее здесь: https://stackoverflow.com/questions/121 ... ets-of-che
Мобильная версия