php - Extract data from a text -
i have text :
begin_general 8 lastline 20130801000028 136606 57288915 25883895742573 firsttime 20130701130426 lasttime 20130731235941 lastupdate 20130802015823 1 0 0 0 0 totalvisits 360 totalunique 246 monthhostsknown 0 monthhostsunknown 454 end_general
i want extract totalvisits
& totalunique
try:
preg_match('/^totalvisits ([0-9]{4}) /ms', $awstats, $matches); $data= $matches; print_array($data);
it render me empty array! why ? thanks
call this:
preg_match('/totalvisits\s([0-9]{3})/', $awstats, $matches);
outputs:
array (size=2) 0 => string 'totalvisits 360' (length=15) 1 => string '360' (length=3)
Comments
Post a Comment