Jump to content

HELP, with array filter


piccavet

Recommended Posts

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.