Parsing the exact match in a text file using a PHP -


i’m new php , trying parse exact sentence in text file using php function preg_grep(). can see below prints out close not exactly. example “[40]=>will work?” prints out “?” isn’t in variable ‘$sta’ . how find , retrieve correct strings?

$lines = file("{$dir}/status.txt");  $sta=”will work”;  $data = preg_grep("/$sta/", $lines);   print_r($data)  ( [40] => s9477 work? 21/09/2014    [41] => s9487  work  21/09/2013    [42] => s9497  work  05/06/2002 )  ) 


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -