I have array like
array(
"v"=>1,
"u"=>8,
"v1"=>45,
"v123"=>12
);
In my program i need to check whether the array contains an element whose key starts with v followed by numbers.My array is very large ,so that I do not prefer iteration.Is there any other efficient way to do this.I expect something like isset(arr[regex]);
You can use array_filter (http://php.net/manual/en/function.array-filter.php)
first creat a callback function:
Then run the array_filter:
You can see the result with the right array_keys:
If you have a result this statement should be true: