SJoosse Posted November 29, 2009 Share Posted November 29, 2009 Hi, sorry to bother you for this naive question, but I can't get it working. What I have is a multidimensional table ($Table: only 2 deminsions) from which I want to extract information, however, the table size is variable ($Statement x $Variable). To extract, my function needs to contain a number of loops that is equal to the size of the number of rows in $Table. Each loop contains again a number of loops that is equal to the number of rows in $Table minus the number of loops it already performed previously. This will be repeated untill all the columns and rows of the table have been handled. It is a bit difficult to explain by text how I want to extract the data, but I hope the function below is clear enough to explain what I want. I recognize I need a function that can loop on itself but keeps the collected data. This example loops back only 3 times, but I need that to be variable. The ECHO statements are just for legibility and would be the place where to extract the data. After the IF statements should probably be the place where to place the function call (I think). Any help on this would be greatly appreciated! <?php $statement = range(0:$Something,1); for($a=0;$a<=sizeof($Table[$statment[0]])-1;$a++){ echo 'A: '.$Table[$statement[0]][$a].'<br /> '; if($statement[0]!=$something){ for($b=0+$a;$b<=sizeof($Table[$statment[1]])-1;$b++){ echo 'B: '.$Table[$statement[1]][$b].'<br />'; if($statement[1]!=$something){ for($c=0+$b;$c<=sizeof($Table[$statment[2]])-1;$c++){ echo 'C: '.$Table[$statment[2]][$c].'<br />'; if($statement[2]!=$something){ for($d=0+$c;$d<=sizeof($SequenceTale echo 'D: '.$Table[$statment[3]][$d].'<br />'; } } echo '<br />'; } } echo '<br />'; } } echo '<br />'; } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.