note 76209 deleted from function.preg-match-all by felipe

From: Date: Mon, 10 Dec 2007 01:56:44 +0000
Subject: note 76209 deleted from function.preg-match-all by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-133082@lists.php.net to get a copy of this message
Note Submitter: Han Jun Kwang (me -at- hjk.ikueb.com) ---- 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.

« previous php.notes (#133082) next »