Hello. I am new to PHP/MYSQL. My array looks like this:

Array
(
    [1] => item1
    [2] => 1tem2
    [3] => item3
    [4] => item4
    [5] => item5
    [6] => item6
)
Array
(
    [7] => item1
    [8] => item2
)
Array
(
    [9] => item1
    [10] => 1tem2
    [11] => item3

I want to loop through each item in each array and for each item i create a new row that looks like this

Array
(
[1]=>item1
[2]=>item1a
[3]=>item2
[4]=>item2a

etc
i have tried achieving this by writing the following

foreach($item as $dkey => $dvavalue){
foreach($dvalue as $value){
for($i=0;$i<$value; $i++){
#some code here
}
}
}   

As i have indicated iam new to programming and also in PHP. I know this might seem like a trivial question but your suggestions on how best to solve this are welcome

This is what i have tried

    foreach($item as $dkey => $dvavalue){
    foreach($dvalue as $value){
    for($i=0;$i<=$value; $i++){
        #some code here
        if($i==0){
            $value = "item";
        }
        else{
        $x=$i +1;
        $value = $value . "_$x";
        }
    }
    }
    }   
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.