$BaseTop = 'DC=Prima,DC=Local'; Array ( [1] => OU=Class01,OU=Room01,DC=Prima,DC=Local \\ |Sub Cat| |Main Cat| |Top| [2] => OU=Class02,OU=Room01,DC=Prima,DC=Local [3] => OU=Domain Controllers,DC=Prima,DC=Local [4] => OU=Room01,DC=Prima,DC=Local [5] => OU=Room02,DC=Prima,DC=Local [6] => OU=Test,DC=Prima,DC=Local )
Why would you want to?
hi, i need to bulid a menu + sub…
Why wouldn’t you use an array?
Something along these lines,
$menu = [
[
"subCat" => "OU=Class01",
"mainCat" => "OU=Room01",
"top" => "DC=Prima",
"page" => "DC=Local"
],
[
"subCat" => "OU=Class02",
"mainCat" => "OU=Room01",
"top" => "DC=Prima",
"page" => "DC=Local"
],
];
this result in loop i need this in foreach function
$BaseTop = 'DC=Prima,DC=Local'; Array ( [1] => OU=Class01,OU=Room01,DC=Prima,DC=Local [2] => OU=Class02,OU=Room01,DC=Prima,DC=Local [3] => OU=Domain Controllers,DC=Prima,DC=Local [4] => OU=Room01,DC=Prima,DC=Local [5] => OU=Room02,DC=Prima,DC=Local [6] => OU=Test,DC=Prima,DC=Local ) i need this result in html Menu + DC=Prima,DC=Local - OU=Domain Controllers + OU=Room01 - OU=Class01 - OU=Class02 - OU=Room02 - OU=Test
you could subtract the base-top string from every array item, then split up every array item one by one and create each key, while using the last created key as a reference, and go back to the root after each element.