$value){ $tweet = $tmp[$key][1] . ' '; //adds a space at the end in case the last word in the tweet is a username while(($at = strpos($tweet, '@', $off)) !== FALSE){ preg_match('/[^@A-Za-z0-9_]/', $tweet, $matches, PREG_OFFSET_CAPTURE, $at); $end = $matches[0][1]; $geph[$tmp[$key][0]][] = strtolower(substr($tweet,$at+1,$end - $at - 1)); //pull all usernames, change to lowercase, strip all non-alphanumerics $off = $at + 1; //move to the next @ } $off = 0; //reset offset if(strpos($tmp[$key][1], '@') === FALSE) $geph[$tmp[$key][0]][] = ''; //fill in blanks for tweets w/o @s } foreach($geph as $key => $value){ foreach($geph[$key] as $yek => $val) $out = $out . strtolower($key) . ',' . $val . "\n"; //create outfile } $outname = $in . '_gephiready_php.csv'; saveData($out,$outname); } $filelist = array(); $homedir = opendir('./'); while (false !== ($file = readdir($homedir))){ if(!is_dir($file) and strpos($file, 'csv') != false) $filelist[] = $file; } closedir($homedir); ?>

Choose formatted Twitter CSV file here (usernames in col A; tweets in col B):

" method="post">
$outname"; ?>