I have an array that looks like:
Array (
    [63] => 0
    [64] => 1
    [65] => 1
    [66] => 0 )
Is there a way to extract the keys for all the values that are equal to 1 (in this case I just want 64 and 65) using Set::extract or Set::remove or some 开发者_高级运维other method?
One way may be like this:
$new_array = array();
foreach($your_array as $value)
{
  if ($value == 1)
  {
    $new_array[] = $value;
  }
}
print_r($new_array);
Or you can use the array_filter function.
Sarfrarz is right.. array_filter will be the most efficient solution.
but if you still want to use cakphp's builtin method then you should look at the manual for such things.
http://book.cakephp.org/view/640/Set
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论