Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/arrays/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 多维数组中的校验值_Php_Arrays_Multidimensional Array_Adldap - Fatal编程技术网

Php 多维数组中的校验值

Php 多维数组中的校验值,php,arrays,multidimensional-array,adldap,Php,Arrays,Multidimensional Array,Adldap,这是我的输出阵列: Array ( [count] => 1 [0] => Array ( [cn] => Array ( [count] => 1 [0] => Testgroep ) [0] => cn [me

这是我的输出阵列:

Array
(
    [count] => 1
    [0] => Array
        (
            [cn] => Array
                (
                    [count] => 1
                    [0] => Testgroep
                )

            [0] => cn
            [member] => Array
                (
                    [count] => 5
                    [0] => CN=Hans Hansen,OU=Test,DC=stefan,DC=nl
                    [1] => CN=Jaap Jaapen,OU=Test,DC=stefan,DC=nl
                    [2] => CN=Peter Petersen,OU=Test,DC=stefan,DC=nl
                    [3] => CN=Piet Pietersen,OU=Test,DC=stefan,DC=nl
                    [4] => CN=Administrator,CN=Users,DC=stefan,DC=nl
                )

            [1] => member
            [distinguishedname] => Array
                (
                    [count] => 1
                    [0] => CN=Testgroep,OU=Test,DC=stefan,DC=nl
                )

            [2] => distinguishedname
            [samaccountname] => Array
                (
                    [count] => 1
                    [0] => Testgroep
                )

            [3] => samaccountname
            [objectcategory] => Array
                (
                    [count] => 1
                    [0] => CN=Group,CN=Schema,CN=Configuration,DC=stefan,DC=nl
                )

            [4] => objectcategory
            [count] => 5
            [dn] => CN=Testgroep,OU=Test,DC=stefan,DC=nl
        )

)
这是数组的php代码:

$result = $adldap->group()->info('Testgroep');
现在我想检查值“OU=Test”是否存在于数组的
[1]=>成员中。我怎样才能做到这一点?我在谷歌上搜索了stackoverflow,但没有找到解决方案。欢迎您的帮助。

试试这段代码

if(strpos($result[0]['distinguishedname'][0], 'OU=Test') !== false) {
    //yep!
}
如果这对您毫无帮助,请更新您的问题并添加更多详细信息,以便我们能够理解


干杯

看一看您是否在寻找该OU中的任何组成员,或这些成员的列表,或完全其他的东西?不,我想检查值“OU=Test”,如果它存在于数组的该部分中。我假设您实际上在谈论数组的
[discrimitedName]
部分。整数键只是用来枚举文本键。如果你仔细观察
[1]=>成员
没有孩子,那是
[DiscriminatedName]
键造成的。我得到一个:
解析错误:语法错误,意外的“[”
是的!它工作得很好,你救了我一天。谢谢你!非常欢迎你。我很高兴我帮了忙。