Re: [PHP] Help with Strings Please

2004-08-31 Thread Nick Wilson
* and then Marek Kilimajer declared > >Im not very good at regex, is there an function that would help me? > >(couldnt see one...) > > > > preg_match('/value\s*=\s*"([0-9]+)"/i', $buffer, $result); > print ("Result:".$result[1]); Marek, you're a star ;-) I *hate* having to ask someone to do

Re: [PHP] Help with Strings Please

2004-08-31 Thread John Holmes
From: "Marek Kilimajer" <[EMAIL PROTECTED]> $handle = fopen("page.php", "r"); while (!feof($handle)) { $buffer .= fgets($handle, 4096); } fclose($handle); file_get_contents() could be helpful here, too... ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe

Re: [PHP] Help with Strings Please

2004-08-31 Thread Justin French
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 hav

Re: [PHP] Help with Strings Please

2004-08-31 Thread Marek Kilimajer
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: $handle = fopen("page.php", "r"); while (!feof($handle)) {

Re: [PHP] help with strings...

2001-08-31 Thread Philip Olson
Not sure what your goal is here but the easiest (and most efficient) way to get the first character of a string is : $string = 'abcdef'; print $string{0}; // prints a print $string{3}; // prints d So in your case, maybe the following craziness is what you're wanting : ${$string{0}} = '

Re: [PHP] help with strings...

2001-08-31 Thread Papp Gyozo
$GLOBALS[substr($string, 0, 1)] or : $tmp = substr($string, 0, 1); ${$tmp} = 'add whatever value you want'; - Original Message - From: Stig-Ørjan Smelror <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, August 31, 2001 9:35 AM Subject: [PHP] help with strings... > Hei all. >