Jun 16, 2008
The problem: you need to turn the values of an HTML select element into a PHP array, and you don't want to do it by hand because it has a lot of entries.
The solution: regular expressions! (using Eclipse's regex search/replace).
- Copy the HTML code of the select element whose values you want to get.
- In eclipse, paste the code in your PHP file.
- Press Ctrl+F to open the find/replace window.
- Click the "Regular expressions" checkbox.
'$1' => '$2',
- Click "Replace All".
- Manually replace the opening and closing