Nick Wilson wrote:
Hi,
I have a string like this, read from an html file: ' VALUE="16">'
The value could be any number. I am trying to get that number.
I have this so far, i was hoping someone might tell me how to get that
number:
<?php
$handle = fopen("page.php", "r");
while (!feof($handle)) {
$buffer .= fgets($handle, 4096);
}
fclose($handle);
$result = stristr($buffer, 'NAME="c"');
print ("Result:<br />".$result);
?>
Im not very good at regex, is there an function that would help me?
(couldnt see one...)
thx...
preg_match('/value\s*=\s*"([0-9]+)"/i', $buffer, $result);
print ("Result:<br />".$result[1]);
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php