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 Quote Link to comment 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 Quote Link to comment 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); ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.