php - How To Regex Search and Replace array_key_exists with isset? -
whats best way regex search , replace instances of array_key_exists()
more efficient isset()
? please, no donald knuth quotes regarding optimizations , yes, i'm aware of differences between 2 functions.
this i'm using in netbeans search , replace:
search for:
array_key_exists\s*\(\s*'([^']*)'\s*,([^)]*)\)
replace with:
isset($2['$1'])
it works , changing this:
array_key_exists('my_key',$my_array)
to
isset($my_array['my_key'])
but doesn't pick instances this:
array_key_exists($my_key,$my_array)
not elegant solution, adding current regex find both types of search criteria.
array_key_exists\s*(\s*'|$['|\s]\s*,([^)]*))
Comments
Post a Comment