有一个类似 [1] 的数组
$arr = array(
array(
"ignoreMe" => "123",
"checkMe" => "value",
),
array(
"ignoreMe" => "456",
"checkMe" => "value",
),
);
我想检查checkMe
内部数组的特殊键(此处为 key )是否具有相同的值。如果所有键都具有相同的值,那么我想从内部数组中删除键。(来自所有数组)
但是当有一个像 [2] 这样的数组时
$arr = array(
array(
"ignoreMe" => "123",
"checkMe" => "value",
),
array(
"ignoreMe" => "456",
"checkMe" => "value",
),
array(
"ignoreMe" => "789",
"checkMe" => "foo",
),
);
所有的钥匙都应该完好无损。
我将如何使用这个复杂的验证器来做到这一点?(链接https://github.com/Respect/Validation)
[1] 的预期结果是
$arr = array(
array(
"ignoreMe" => "123",
),
array(
"ignoreMe" => "456",
),
);
[2] 不应触碰
这是已经尝试过的:
$validator = v::arr()->each(v::key("check", v::equals('value')));