preg_match
| From: | Rafael Dohms | Date: | Fri, 08 Jul 2011 12:12:37 +0000 |
| Subject: | preg_match | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-53777@lists.php.net to get a copy of this message | ||
I was wondering if anyone ever thought of either fixing or writing a
new function that would make preg_match actually work in a way that
made sense?
right now i need to pass in a optional parameter that will receive the
match, in this case one or no match, why should this not be the
function's return already?
something like:
$string = "<td>my text</td>";
$result = preg_match("/\<td\>(.*)\<\/td\>/", $string);
$result // = "my text"
Maybe something like preg_extract? I do not have the C skills to write
a patch but i think adding a new function would not break BC or have
negative side effects, would it?
--
Rafael Dohms
PHP Evangelist and Community Leader
http://www.rafaeldohms.com.br
http://www.phpsp.org.br