3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $urls = '<option value="http://foo.bar" selected="selected">value</option> <option value="http://bar.foo">test</option>'; $matches = array(); preg_match_all('/<option\svalue="([^"]*)"(?:\s+selected="(selected)")?>([^>]*)<\/option>/', $urls, $matches); var_dump($matches);
Output for 4.3.0 - 7.1.0
array(4) { [0]=> array(2) { [0]=> string(65) "<option value="http://foo.bar" selected="selected">value</option>" [1]=> string(44) "<option value="http://bar.foo">test</option>" } [1]=> array(2) { [0]=> string(14) "http://foo.bar" [1]=> string(14) "http://bar.foo" } [2]=> array(2) { [0]=> string(8) "selected" [1]=> string(0) "" } [3]=> array(2) { [0]=> string(5) "value" [1]=> string(4) "test" } }