开发者

Extracting array with set::class utility

开发者 https://www.devze.com 2022-12-23 06:27 出处:网络
Is there a way to extract the array for a specified id with the set::class utiliy? I can\'t figure out the XPath.

Is there a way to extract the array for a specified id with the set::class utiliy? I can't figure out the XPath.

I.E. I would like to extract the array where the id = 1

[Document] => Array
        (
            [0] => Array
                (
                    [id] => 1
                    [filename] => 1.txt
                )

            [1] => Array
                (
                    [id] => 2
                    [filename] => 2.txt
                )

            [2] => Array
                (
                    [id] => 3
                    [filename] => 3.txt
               开发者_JAVA技巧 )


        )


Try:

Set::extract('/[id=1]', $data['Document']);

or

Set::extract('/[id=1]/..', $data['Document']);

0

精彩评论

暂无评论...
验证码 换一张
取 消