Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have two-dimensional array $id[][] and i'm accessing data by using two foreach loops

    foreach ($id as $index=>$val)
{

    foreach ($val as $ind=>$id_val)
{
...

}

}

but how to do that without first foreach, so looping process would start and end on specified index, for example $id[1]["and now looping with foreach second dimension"]. Number of records on second dimension may differ.

How to achieve that, like in other programming languages with just simply putting index of 1st dimension and beginning loopiing on second only ?

share|improve this question
4  
foreach ($id[1] as $index => $val) ... –  Justin Iurman Feb 16 at 21:11
    
Thanks ;d Omg, I was trying some voodoo tricks and that was so easy to do. –  norbidrak Feb 16 at 21:15

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.