devWhiz Posted March 21, 2011 Share Posted March 21, 2011 Ok so I have a file with data like this 530450112 1dda5a716d3f1fa8eb77ab6342b93db11a195698 530454485 90a7da1adab91b946765c050dffbf15c2dc2d973 530445119 89b5ee9bce1efb1858905069130692122917ce2e 533930984 0802f4cb048bac747b87f4bc9a6f9bbe92d38d8a Now the code I have... $KeysFile = 'keys.txt'; // File with keys.... $keys = file($KeysFile); foreach($keys as $aKeys) { $Keys = explode(' ', $aKeys); $AccountInfo[] = array($Keys[0], trim($Keys[1])); } for($z=1; $z!=$AccountData; $z++){ var_dump($Keys[0]); } why does it print out the last id of the script 4 times instead of each of the id numbers once? its like string(9) "533930984" string(9) "533930984" string(9) "533930984" string(9) "533930984" shouldnt it be string(9) "530450112" string(9) "530454485" string(9) "530445119" string(9) "533930984" Helppp Thanks Link to comment https://forums.phpfreaks.com/topic/231241-this-array-is-not-working-for-me/ Share on other sites More sharing options...
Pikachu2000 Posted March 21, 2011 Share Posted March 21, 2011 That code could not have produced that output. What output are you trying to get from that file? Link to comment https://forums.phpfreaks.com/topic/231241-this-array-is-not-working-for-me/#findComment-1190161 Share on other sites More sharing options...
devWhiz Posted March 21, 2011 Author Share Posted March 21, 2011 Ahh, I forgot to add the for loop I had in the code, I figured out the problem though. Thanks Link to comment https://forums.phpfreaks.com/topic/231241-this-array-is-not-working-for-me/#findComment-1190165 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.