php中的键,值和数组

I am using symfony2.3,

I want to know that How I can get rewardPoints on id bases and which position this id hold in Array between 0 to 4 ?

Like :

I have already got Logged User Id:-

 id = 8; 

In Array I got this :-

Array
(
 [0] => Array
    (
        [rewardPoints] => 790
        [id] => 1
    )

 [1] => Array
    (
        [rewardPoints] => 35
        [id] => 8
    )

 [2] => Array
    (
        [rewardPoints] => 25
        [id] => 14
    )

 [3] => Array
    (
        [rewardPoints] => 10
        [id] => 15
    )

 [4] => Array
    (
        [rewardPoints] => 5
        [id] => 16
    )

)

Sorry for my English.

Thanks.

Hope this will help you

$counter = 0;
foreach($yourArray as $subArray){
     if($subArray['id'] == 8){         // here set the id what you need
        $position =   $counter;
         $revertPoint = $subArray['rewardPoints']; //here you set the rewardPoints into variable
      }
      $counter++;
}

echo $revertPoint;//result 
echo $position; // position in main array