[ create a new paste ] login | about

Link: http://codepad.org/prSBWILG    [ raw code | output | fork ]

PHP, pasted on Apr 12:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
 $tests = array(
    array('ID'=>1), 
    array('ID'=>2), 
    array('ID'=>3), 
    array('ID'=>4), 
    array('ID'=>5), 
    array('ID'=>6)
);
$_POST['testSelect'] = 3;
?>
<?php
          foreach ($tests as $test){
              echo $test['ID']."<br>"; //output 1  2  3  4  5   6
              echo $_POST['testSelect'].'<br>';  //output 3 3 3 3 3 3

              if($test['ID'] == $_POST['testSelect']){  //which 3 mataches 3
                  echo 'match';
              }
          }
      ?>


Output:
1
1<br>3<br>2<br>3<br>3<br>3<br>match4<br>3<br>5<br>3<br>6<br>3<br>


Create a new paste based on this one


Comments: