rarebit Posted May 11, 2008 Share Posted May 11, 2008 Hi, is there a better way to find if a key 'partially' exists in an array. When I say better I mean a built in function? Heres what i've scraped together: $key = -1; foreach($_POST as $k => $v) { if(strcmp("SUB_", substr($k, 0, 4))==0) { $key = $k; break; } } It comes from a submit button and probably not allowed to use an array of buttons... Cheers! Link to comment https://forums.phpfreaks.com/topic/105144-a-better-way/ Share on other sites More sharing options...
BlueSkyIS Posted May 11, 2008 Share Posted May 11, 2008 When I say better I mean a built in function? not that i'm aware of. Link to comment https://forums.phpfreaks.com/topic/105144-a-better-way/#findComment-538303 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.