...

View Full Version : Password Generator



yikomaka
10-15-2005, 04:03 AM
This is supposed to display microtime number in md5 encryption but only 8 letters of it but all it displays is $mc

heres code

<?php
$mc=microtime();
$mc=md5($mc);
$e= substr('$mc', 0,8);
echo $e;
?>

pjleonhardt
10-15-2005, 07:08 AM
Change


$e= substr('$mc', 0,8);

to


$e = substr($mc, 0 8);


notice the lack of single quotes. The single quotes tell PHP you're giving it a string, so its treats it as one. Not as a variable.

yikomaka
10-15-2005, 07:40 AM
this is my code now


<?php
$mc=microtime();
$mc=md5($mc);
$e = substr($mc, 0 8);
echo $e;
?>

it errors still saying;
Parse error: parse error, unexpected T_LNUMBER in /home/newage/public_html/lewis/test2.php on line 13

looka
10-15-2005, 08:29 AM
still the beginner. parameters of the function must be separated with commas.

your

$e = substr($mc, 0 8);
suffers a lack of them.


$e = substr($mc, 0, 8);

yikomaka
10-15-2005, 09:04 AM
I had em in first place, but other guy took em out didnt notice thanks for help though and of course im a beginner...



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum