BRADERY Posted December 21, 2010 Share Posted December 21, 2010 say I have a file, it has information in it in this format 123489 ABDFDS 232356 DSFKWE and so on, new number and letters on each line separated by a space, what do I have to do so that like 123489 and 232356 would be in the aray numbers[] and the ABDFDS and DSFKWE would be phrases[] any ideas? Thanks Link to comment https://forums.phpfreaks.com/topic/222282-from-file-to-array/ Share on other sites More sharing options...
BK87 Posted December 21, 2010 Share Posted December 21, 2010 http://us3.php.net/manual/en/function.fopen.php Link to comment https://forums.phpfreaks.com/topic/222282-from-file-to-array/#findComment-1149836 Share on other sites More sharing options...
litebearer Posted December 21, 2010 Share Posted December 21, 2010 perhaps... <?PHP $lines = file($filename); $i=0; $w=count($lines); while($i<$w){ $ja = explode(" ",$lines[$i]); $numbers[] = $ja[0]; $phrases[] = $ja[1]; $i ++; } print_r($numbers); print_r($phrases); ?> Link to comment https://forums.phpfreaks.com/topic/222282-from-file-to-array/#findComment-1149845 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.