Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-15-2005, 04:03 AM   PM User | #1
yikomaka
New Coder

 
Join Date: Sep 2005
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
yikomaka is an unknown quantity at this point
Password Generator

This is supposed to display microtime number in md5 encryption but only 8 letters of it but all it displays is $mc

heres code
Quote:
<?php
$mc=microtime();
$mc=md5($mc);
$e= substr('$mc', 0,8);
echo $e;
?>
yikomaka is offline   Reply With Quote
Old 10-15-2005, 07:08 AM   PM User | #2
pjleonhardt
New Coder

 
Join Date: Apr 2005
Posts: 97
Thanks: 0
Thanked 0 Times in 0 Posts
pjleonhardt is an unknown quantity at this point
Change
PHP Code:
$esubstr('$mc'0,8); 
to
PHP Code:
$e substr($mc0 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.
pjleonhardt is offline   Reply With Quote
Old 10-15-2005, 07:40 AM   PM User | #3
yikomaka
New Coder

 
Join Date: Sep 2005
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
yikomaka is an unknown quantity at this point
this is my code now

Quote:
<?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
yikomaka is offline   Reply With Quote
Old 10-15-2005, 08:29 AM   PM User | #4
looka
Regular Coder

 
Join Date: Aug 2004
Posts: 280
Thanks: 0
Thanked 0 Times in 0 Posts
looka is an unknown quantity at this point
still the beginner. parameters of the function must be separated with commas.

your
PHP Code:
 $e substr($mc0 8); 
suffers a lack of them.

PHP Code:
 $e substr($mc08); 
looka is offline   Reply With Quote
Old 10-15-2005, 09:04 AM   PM User | #5
yikomaka
New Coder

 
Join Date: Sep 2005
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
yikomaka is an unknown quantity at this point
I had em in first place, but other guy took em out didnt notice thanks for help though and of course im a beginner...
yikomaka is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:02 PM.


Advertisement
Log in to turn off these ads.