[eluser]xwero[/eluser]
@Pygon: you can do this in one line
Code:
$needle = 'test';
$keys = array_keys($somearray);
if(in_array($needle,$keys)) // here the magic happens
{
// do something with the array and the key
}
This way you only have to do one function call to get the array keys.
The main reason why i have written the functions is because sometimes i append data to my button names which makes it impossible to check them with php native functions. And because the buttons are created dynamically i can't hardcode the button action.
Code:
<input type="submit" name="update_1" value="Update"><br>
<input type="submit" name="update_2" value="Update">
I could do the same as in the first snippet and make the second parameter the keys array which saves me a function call but i know my lazy self and i will end up doing
Code:
array_key_matches_string('update_',array_keys($_POST));
Oh well use it any way you want the functions are up for grabs