Wednesday, December 5, 2012

Re: How I get the index value using Hash::extract() on this array

Hi,

I solved it using this logic:

foreach ($arrayCheckBoxCheked as $idBilling => $value) {

if ($value['check'] == 0) {
unset($arrayCheckBoxCheked[$idBilling]);
}
}


I will try implement you solution. thank you!!


Em quarta-feira, 5 de dezembro de 2012 15h49min21s UTC-2, cricket escreveu:
This should do it:

$keys = array_keys(Hash::remove('{n}[check=0]'));

On Wed, Dec 5, 2012 at 11:50 AM, Lucas Simon Rodrigues Magalhaes
<luca...@gmail.com> wrote:
> Array(
> [168] => Array
>     (
>         [check] => 0
>     )
>
> [169] => Array
>     (
>         [check] => 1
>     )
>
> [170] => Array
>     (
>         [check] => 1
>     )
>
> [171] => Array
>     (
>         [check] => 1
>     )
>
> [172] => Array
>     (
>         [check] => 0
>     )
> );
>
>
> I try it, $a = Hash::extract($arrayCheckBoxCheked,'{n}[check=1]'); pr($a);
> but it returns:
>
> Array
> (
>     [0] => Array
>         (
>             [check] => 1
>         )
>
>     [1] => Array
>         (
>             [check] => 1
>         )
>
>     [2] => Array
>         (
>             [check] => 1
>         )
>
> )
>
>
>
> I need the index of this array.
>
>
>
>
>
> --
> 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 post to this group, send email to cake...@googlegroups.com.
> To unsubscribe from this group, send email to
> cake-php+u...@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>

--
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 post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

No comments: