Hash::get() & Hash::extract()

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Hash::get() & Hash::extract()

John Fernandes
Hi,

I am a noob at CakePHP. I have the following array:

$fooArray = Array
(
    [0] => Array
        (
            [Foo] => Array
                (
                    [foo_id] => 100
                    [foo_role_id] => 10
                )

        )

)

I looked at the Hash::get() & Hash::extract() methods. I would like to extract the value of 'foo_id' where 'foo_role_id' is 10.

I was using the below statement but it doesn't work:
Hash::extract($fooArray, '{n}.Foo[foo_role_id = 10].foo_id');


Please help me correct the above statement.

Thanks!

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.