I have an associative arrays and an array of keys.

$A = array('a'=>'book', 'b'=>'pencil', 'c'=>'pen');
$B = array('a', 'b');

How I build an associative array from all element of $A where the key is in $B? For the example above, the answer should be

$C = array('a'=>'book', 'b'=>'pencil');
Edit
Report