phpregexnetbeansissetarray-key-exists

How To Regex Search and Replace array_key_exists with isset?


Whats the best way to do a regex search and replace for all instances of array_key_exists() with the more efficient isset()? Please, no Donald Knuth quotes regarding optimizations and yes, I'm aware of the differences between the two functions.

This is what I'm currently using in my Netbeans search and replace:

it works well , changing this:

array_key_exists('my_key',$my_array)

to

isset($my_array['my_key'])

but doesn't pick up instances like this:

array_key_exists($my_key,$my_array)

Solution

  • The best I could do was to run a second search and replace to cover the instances that used variables for both arguments:

    array_key_exists($my_key,$my_array)

    search and replace 2: