I want to find whats between 2 things, ie:
<hits>588</hits>
is in my text file, and i want to get '588'.
i looked through the function list ( http://us4.php.net/manual/en/ref.strings.php ) but i cant find what im looking for..
thanks
searching a string [SOLVED] =)
Moderator: General Moderators
-
d3ad1ysp0rk
- Forum Donator
- Posts: 1661
- Joined: Mon Oct 20, 2003 8:31 pm
- Location: Maine, USA
searching a string [SOLVED] =)
Last edited by d3ad1ysp0rk on Mon Feb 02, 2004 5:22 pm, edited 1 time in total.
-
d3ad1ysp0rk
- Forum Donator
- Posts: 1661
- Joined: Mon Oct 20, 2003 8:31 pm
- Location: Maine, USA
-
d3ad1ysp0rk
- Forum Donator
- Posts: 1661
- Joined: Mon Oct 20, 2003 8:31 pm
- Location: Maine, USA
THANK YOU for your help!
Here's what I came up with incase anyone else needed something like this:
Here's what I came up with incase anyone else needed something like this:
Code: Select all
<?php
function findinfile($filename,$start,$end){
$handle = fopen($filename, "a+");
$string = fread($handle, filesize($filename));
$pos1 = strpos($string,$start);
$pos2 = strpos($string,$end);
$pos1 = $pos1 + 6;
$length = $pos2 - $pos1;
$val = substr($string, $pos1, $length);
return $val;
}
?>