Filtering an array in php, having both value- and key-related conditions
I'm trying to filter an array, in which the filter function is supposed to check for multiple conditions. For example, if element x starts with a capital letter, the filter function should return true. Except, if the element __before__ element x satisfies certain other conditions, then element x should __not__ stay in the array and the filter function should therefore return false.

Problem is that the callback function in array_filter only passes the element's value and not its key... doing some magic with array_search will probably work, but I was just wondering whether I'm looking in the wrong place for this specific issue?
Filtering an array in php, having both value- and key-related conditions
===

I'm trying to filter an array, in which the filter function is supposed to check for multiple conditions. For example, if element x starts with a capital letter, the filter function should return true. Except, if the element __before__ element x satisfies certain other conditions, then element x should __not__ stay in the array and the filter function should therefore return false.

Problem is that the callback function in array_filter only passes the element's value and not its key... doing some magic with array_search will probably work, but I was just wondering whether I'm looking in the wrong place for this specific issue?