Recursive query properties

how to loop out the following format

array(
  "detali"=> 
        array(""=>)
        array(""=>)
        array(""=>1)
)
array(
  "detali"=> 
        array(""=>)
        array(""=>)
        array(""=>1)
)
array(
  "detali"=> 
        array(""=>)
        array(""=>)
        array(""=>2)
)
array(
  "detali"=> 
        array(""=>)
        array(""=>)
        array(""=>2)
)
array(
  "detali"=> 
        array(""=>)
        array(""=>)
        array(""=>1)
)
array(
  "detali"=> 
        array(""=>)
        array(""=>)
        array(""=>1)
)
array(
  "detali"=> 
        array(""=>)
        array(""=>)
        array(""=>2)
)
array(
  "detali"=> 
        array(""=>)
        array(""=>)
        array(""=>2)
)
Php
Mar.17,2021

Code:

$arr = [
    ['value' => '', 'detailValue' => '', 'attrHidden' => true, 'detail' => ['','']],
    ['value' => '', 'detailValue' => '', 'attrHidden' => true, 'detail' => ['','']],
    ['value' => '', 'detailValue' => '', 'attrHidden' => true, 'detail' => ['1','2']]
];

function decare($arr){
    $data = [];
    $res = [];
    for ($i=0; $i < count($arr)-1; $iPP) { 

        if($i == 0){
            $data = $arr[$i]['detail'];
        }
        //1
        $rep1 = [];

        foreach ($data as $v) {
            foreach ($arr[$i+1]['detail'] as $g) {
                //2
                $rep2 = ($i!=0?'':$arr[$i]['value']."_").$v."-".$arr[$i+1]['value']."_".$g;
                $tmp[] = $rep2;
                if($i==count($arr)-2){
                    foreach (explode('-', $rep2) as $k => $h) {
                        //3
                        $rep3 = explode('_', $h);
                        //4
                        $rep4['detail'][$rep3[0]] = $rep3[1];
                    }
                    $res[] = $rep4;
                }
            }
        }

        $data = $tmp;
    }
    return [$data,$res];
}
print_r(decare($arr)[1]);

result:

clipboard.png

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eb03b8-22bb.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eb03b8-22bb.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?