It is worth noting that array_keys does not maintain the data-type of the keys when mapping them to a new array. This created an issue with in_array and doing a lookup on characters from a string. NOTE: my lookup $array has a full map of numbers and characters - upper and lower - to do an simple faux encryption with.

If an array is empty (but defined), or the $search_value is not found in the array, an empty array is returned (not false, null, or -1). This may seem intuitive, especially given the documentation says an array is returned, but I needed to sanity test to be sure:

One can apply array_keys twice to get the position of an element from its key. (This is the reverse of the function by cristianDOTzuddas.) E.g., the following may output "yes, we have bananas at position 0".

might be worth noting in the docs that not all associative (string) keys are a like, output of the follow bit of code demonstrates - might be a handy introduction to automatic typecasting in php for some people (and save a few headaches):

Note, that using array_key_exists() is rather inefficient. The overhead associated with calling a function makes it slower, than using isset($array[$key]), instead of array_key_exists($key, $array)using isset() is usually about 1.3 times faster, according to my tests.

I was looking for a function that simply unset a variable amout of values from a one-dimensional array by key. I ended up with this (returns the array itself if no further parameter than the array is given, false with no params - does not change the source array)

It should be noted that the inverse function to keys (which converts keys to values) is array_count_values (which converts values to keys). This is needed to use things like array_intersect_key. Could go in several places. Took me a while to figure it out.

I was looking for a function that deletes either integer keys or string keys (needed for my caching).As I didn't find a function I came up with my own solution.I didn't find the propiest function to post to so I will post it here, hope you find it useful.

You can of course define constants to have a nicer look, I have chosen these: EXTR_INT = 1; EXTR_STRING = 2EXTR_INT will return an array where keys are only integer whileEXTR_STRING will return an array where keys are only string

I was trying to figure out how to normalize an array with numerical keys. Since I was doing for() for a lot of things, but only replacing it if the conditions were right, I wound up with off ball arrays I couldn't access. That being said, I looked for a method of normalizing the array and couldn't find one, so I built my own. I'm not sure how to go about making it recursive, but I didn't need that feature for my own, so I just went without recursion.