时间:2021-07-01 10:21:17 帮助过:30人阅读
$a = array('a' => 'apple', 'b' => 'banana', 'p' => 'pear');$key = array('a','b','p');foreach($key as $k) $val[] = $a[$k];print_r($val);
Array( [0] => apple [1] => banana [2] => pear)
$a = array( 'a'=>'apple', 'b'=>'banana', 'p'=>'pear');$key = array('a','b','p');$val = array();foreach($key as $v){ array_push($val, $a[$v]);}print_r($val);
$a = array('a' => 'apple', 'b' => 'banana', 'p' => 'pear');$key = array('a','b','p');foreach($key as $k) $val[] = $a[$k];print_r($val);
Array( [0] => apple [1] => banana [2] => pear)
没有自带,你就自己写