Nick,

Nick wrote:

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.

If you have that exact string and you want to extract just the number, then a simple regex to delete all non-numeric characters should suffice.


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);

?>

Ok, so I don't see ' VALUE="16">' in here anywhere -- I think you need to be a lot more descriptive about the source content and what exactly you want to extract, and provide a few examples, so that we can cover all your bases.


Regular Expressions are _probably_ what you need, but you REALLY need to provide a decent description and multiple examples of what you want, otherwise we're just wasting time.

---
Justin French
http://indent.com.au

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to