3
我试图根据存储在其中的值查找索引。根据值查找数组索引
这通常很容易,但我正在使用的数组是高度嵌套的。每个索引0,1,2
都有字段f1,f2,f3
。我试图找到0,1,2
在其f2
字段中存储的值this
。在这种情况下,它是索引0
。所以这是我正在寻找的输出。在PHP中有这样一个巧妙的技巧来有效地做到这一点吗?
$somearray[0][f1] = "not this";
$somearray[0][f2] = "this";
$somearray[0][f3] = "not this";
$somearray[1][f1] = "not this";
$somearray[1][f2] = "not this";
$somearray[1][f3] = "not this";
$somearray[2][f1] = "not this";
$somearray[2][f2] = "not this";
$somearray[2][f3] = "not this";
谢谢。做我想做的事情。 – lok 2010-08-18 01:19:47
@lok:不客气:) – Sarfraz 2010-08-18 04:37:27