<html> <body> <?php $myArray['a1'] = 1; $myArray['a2'] = 2; $myArray['b1'] = 3; $myArray['b2'] = 4; $startKey[0] = 'a'; $startKey[1] = 'b'; for( $i = 1; $i<3; $i++ ) { for( $j = 0; $j<2; $j++ ) { echo $myArray[$startKey[$j] . $i]; } } echo '<br>'; for( $i = 0; $i<2; $i++ ) { for( $j = 1; $j<3; $j++ ) { echo $myArray[$startKey[$i] . $j]; } } ?> </body> </html>
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy. Accept Learn more