有我也有删除一个阵列的关键 不是已经在其他阵列,像取出钥匙在其它阵列
/**
* I Have This Array, With Keys
* Name, Lastname, Date
*/
$Array = Array('name' => 'Mike', 'lastname' => 'Griggs', 'date' => strftime('%A %c'));
/**
* And The Split , Make This One Array
*/
$Fields = 'name, lastname';
foreach(split(',', str_replace(' ', NULL, $Fields)) as $Index => $Field):
if(!array_key_exists($Field, split(',', str_replace(' ', NULL, $Fields)))):
unset($Array[$Field]);
endif;
endforeach;
print_r($Array);
/**
* i Have to Remove The Elements of $Array
* That Not Have in $Fields, In This Case, Unset 'date' From $array
*/
但Retorning日期字段在阵列 我需要取消设置键不都在$领域从Array, 如果不要有名称的Array,只返回名字..
感谢的[]
你为什么善用每一个字? – Blender 2011-04-23 18:41:12
对不起,不了解你问题=) – XMLP4rse 2011-04-23 18:42:23
我也没有,对不起... – Blender 2011-04-23 18:43:24