$file = "list.tab";// Your Temp Uploaded file $cols = array(); ini_set('auto_detect_line_endings', true); $fh = fopen($file, 'r'); $i = 0; while (($line = fgetcsv($fh, 1000, "\t")) !== false) { $cols[] = $line; } n_cols=count($cols) echo ($cols[rand ( 0,n_cols )])