Re: Help with Strings Please

From: Date: Tue, 31 Aug 2004 13:48:34 +0000
Subject: Re: Help with Strings Please
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-195277@lists.php.net to get a copy of this message
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

« previous php.general (#195277) next »