note 76209 added to function.preg-match-all
| From: | (me-at-hjk.ikueb.com) | Date: | Thu, 05 Jul 2007 07:38:22 +0000 |
| Subject: | note 76209 added to function.preg-match-all | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-128243@lists.php.net to get a copy of this message | ||
Here's a simple function to retrieve attribute values of HTML tags:
<?php
function getAttribs($t, $a, $s) {
preg_match_all("/(<".$t."
.*?".$a.".*?=.*?\")(.*?)(\".*?>)/", $s, $m);
return $m[2];
}
?>
Where $t is the tag name (e.g. img), $a is the attribute you are looking for (e.g. src) and $s is
the HTML string.
----
Server IP: 202.79.178.90
Probable Submitter: 203.118.40.37
----
Manual Page -- http://www.php.net/manual/en/function.preg-match-all.php
Edit -- https://master.php.net/note/edit/76209
Del: integrated -- https://master.php.net/note/delete/76209/integrated
Del: useless -- https://master.php.net/note/delete/76209/useless
Del: bad code -- https://master.php.net/note/delete/76209/bad+code
Del: spam -- https://master.php.net/note/delete/76209/spam
Del: non-english -- https://master.php.net/note/delete/76209/non-english
Del: in docs -- https://master.php.net/note/delete/76209/in+docs
Del: other reasons-- https://master.php.net/note/delete/76209
Reject -- https://master.php.net/note/reject/76209
Search -- https://master.php.net/manage/user-notes.php