piccavet Posted March 15, 2011 Share Posted March 15, 2011 Hi ! I have an 2d array like this: column 1 column 2 column 3 $data[0][0] $data[0][1] $data[0][2] $data[0][0] RDR -1.3 0.001 $data[1][0] RQR 0.4 0.01 $data[2][0] DDR 1 0.00004 and more... Now i need to filter this data. I only need the rows with column 3 < 0.01 AND column2 > 1 or column 2 < -1 . I have this, but it doesn't work: $teller = 0; for($i = 0; $aantal>$i; $i++) { if($data[$i][2]<=0.01) { $p[$teller][0] = $data[$i][0]; $p[$teller][1] = $data[$i][1]; $p[$teller][2] = $data[$i][2]; $teller++; } } $teller2 = 0; for($i = 0; $teller>$i; $i++) { if($p[$i][1] < -1 || $p[$i][1] > 1 ) { #als de p value kleiner is dan 0.01 dan alles kopieren in een nieuwe array $r[$teller2][0] = $p[$i][0]; $r[$teller2][1] = $p[$i][1]; $r[$teller2][2] = $p[$i][2]; $teller2++; } } Can you help me? Link to comment https://forums.phpfreaks.com/topic/230683-help-with-array-filter/ Share on other sites More sharing options...
piccavet Posted March 15, 2011 Author Share Posted March 15, 2011 Problem solved. I wanted to check if 0,001 > 0.1 something wrong with my comma delete topic? Link to comment https://forums.phpfreaks.com/topic/230683-help-with-array-filter/#findComment-1187737 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.