I have array like and used array_keys to get keys:
$arr = array( 1 => 1,
2 => 3,
3 => 2,
5 => 0,
6 => 0 );
$new_arr = array_keys($arr);
Now, I want to get array_keys if value is not zero. How can i do this?
Please help.
Run
array_filter
on your array before you get the keys; that removes the 0 values and you only get the keys you need.Output