<?php $a = array("test"=>"1", "test2"=>2, "test3"=>3); $needed = array("test", "test2"); foreach($a as $i => $v) { if(!in_array($i, $needed)) { unset($a[$i]); } } print_r($a);
You have javascript disabled. You will not be able to edit any code.