Welcome Guest, Not a member yet? Register   Sign In
Extracting string from between two strings multiple times..
#5

[eluser]ηυмвєяσηє[/eluser]
Okay this is my last example, tested by me.. ^^
Code:
$file_path = './';
$filename = 'mytext.txt';

$handle = fopen($file_path.$filename, "r");
$data = fread($handle, filesize($filename));

//$start_string = $this->input->post('start_string');
//$stop_string = $this->input->post('stop_string');
$start_string ='te';
$stop_string = 're';

preg_match_all('/' . $start_string. '(.*)' . $stop_string . '/Usi' , $data, $strings);

echo '<pre>';
print_r($strings[1]);
echo '</pre>';


Messages In This Thread
Extracting string from between two strings multiple times.. - by El Forum - 06-28-2011, 01:09 PM



Theme © iAndrew 2016 - Forum software by © MyBB