我如何通过一个数组通过函数,例如:功能与数组变量
$data = array(
'color' => 'red',
'height' => 'tall'
);
something($data);
function something($data) {
if ($data['color'] == 'red') {
// do something
}
}
我怎样才能获得的功能识别$data[color]
和$data[height]
?
你的意思是你需要的功能是能够修改数组吗? – 2010-06-08 06:15:14
我需要函数来理解$ data [color]等于红色。这样我就可以使用:函数 – Booski 2010-06-08 06:17:16
中的if($ data [color] =='red'){做某事},你已经有了你的函数。它有什么问题? – 2010-06-08 06:21:15