function readFiles($file_path){ $handle = fopen($file_path, 'r'); while (!feof($handle)) { yield trim(fgets($handle)); } fclose($handle); }
$words = readFiles('./word.txt'); foreach($words as $word){ $word_list = explode(',',$word); foreach($word_list as $k=>$v){ print_r($v);die; } }