u try this!
foreach($test as $element)
$result = $element['Deep1']['Deep2']['extract'];
2011/5/2 Gluckens <[email protected]>
> Hi everyone,
>
> I'm trying to extract data from an array containing only one element
> and it doesn't seem to work properly.
> Here's an example :
>
> Starting array
> $test = array(4 => array('Deep1' => array('data1' => 'nothing',
> 'Deep2' => array('extract' => 1))));
> Array
> (
> [4] => Array
> (
> [Deep1] => Array
> (
> [data1] => nothing
> [Deep2] => Array
> (
> [extract] => 1
> )
> )
> )
> )
>
> Set::extract('/Deep1/Deep2[extract=1]', $test);
> NOT CORRECT
> Array
> (
> )
>
> But, when I add another element, let's say
> $test[12] = array();
> It works fine
> Set::extract('/Deep1/Deep2[extract=1]', $test);
> CORRECT
> Array
> (
> [0] => Array
> (
> [Deep2] => Array
> (
> [extract] => 1
> )
> )
> )
>
> Am I using it properly?
> Thanks in advance for any help.
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> [email protected] For more options, visit this group
> at http://groups.google.com/group/cake-php
>
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others
with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php