Help - Search - Members - Calendar
Full Version: foreach problems
Weborum Webmaster Forum > Web Page Design > PHP
morrowasted
For a perfectly legal reason, I want to take a list of words, each on one line, and md5 them. I had this:

<?
$fp = fopen("pass.txt", 'r');
$neat = explode("\n", $fp);
foreach($neat as $word) {
echo md5($word);
}
?>

But it only did the first line. What can I do?


ON A SIDE NOTE: Does anyone know of an already made md5 list biggrin.gif?



Of course, this is for nothing illegal businesssmiley.gif .
morrowasted
*sigh* I forgot to fread. Now I have...

<?
$fp = fopen("pass.txt", 'r');
$cool = fread($fp, filesize("pass.txt"));
$neat = explode("/n", $cool);
foreach($neat as $word) {
echo md5($word);
}
?>

But its still doing only the first line.

EDIT: Double Sigh. It should be \n, not /n.


<------ Feels Dumb.
Timo
So did you solve your problem?
morrowasted
well i solved that problem, but i still cant seem to get... what i want done... done.. heh
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.