[eluser]xwero[/eluser]
I should read more blogs or take the time to remember all the string functions php offers.
The preg_match in helper is replaced by strncasecmp.
Code:
/**
* Array match key - checks if the array key exists using a string
*
* @access public
* @param string
* @param array
* @return mixed
*/
function array_key_matches_string($string,$array)
{
$postkeys = array_keys($array);
foreach($postkeys as $key)
{
if(strncasecmp($string,$key,strlen($string)) == 0)
{
return $key;
}
}
return false;
}
now you can do
Code:
$updatematch = array_match_key('update_',$_POST);
if(is_string($updatematch))
{
$id = str_replace('update_',0,$updatematch);
}
This way it's closer to the native php functions but you lose the flexibility regex offers. I have to look into the performance for the two functions.