morningside Posted September 9, 2011 Share Posted September 9, 2011 Hello I am tring to import a .txt file into an array. I am stuck will somone please help me. ?<php $fp = fopen("ArrayTestFile.txt", 'wb'); $X = fread("ArrayTestFile.txt" 'w'); for ($j = 0 ; $j < 6 ; ++$j) { $written = fwrite($fp, "ArrayTestFile.txt"); if ($written == FALSE) break; } print $fp[0] . " " . $fp[1] . " " . $fp[2] . " " . $fp[3] . " " . $fp[4]; fclose($fp); ?> Link to comment https://forums.phpfreaks.com/topic/246762-importing-a-txt-file-into-an-array/ Share on other sites More sharing options...
voip03 Posted September 9, 2011 Share Posted September 9, 2011 Try explode http://www.homeandlearn.co.uk/php/php10p7.html Link to comment https://forums.phpfreaks.com/topic/246762-importing-a-txt-file-into-an-array/#findComment-1267247 Share on other sites More sharing options...
AbraCadaver Posted September 9, 2011 Share Posted September 9, 2011 file() does this automatically. Link to comment https://forums.phpfreaks.com/topic/246762-importing-a-txt-file-into-an-array/#findComment-1267357 Share on other sites More sharing options...
voip03 Posted September 9, 2011 Share Posted September 9, 2011 http://www.phpfreaks.com/forums/index.php?topic=343514.msg1620818#msg1620818 Link to comment https://forums.phpfreaks.com/topic/246762-importing-a-txt-file-into-an-array/#findComment-1267429 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.