Combine variable and text creating email address?

the mail() function

Moderators: egami, macek, gesf

Post Reply
User avatar
Nullsig
php-forum Fan User
php-forum Fan User
Posts: 979
Joined: Thu Feb 17, 2011 6:52 am
Location: Racine, WI

Mon Apr 18, 2011 11:16 am

Code: Select all

$email = $start . '@email.uk';
$to = $email;

User avatar
egami
php-forum GURU
php-forum GURU
Posts: 2192
Joined: Wed Oct 06, 2010 11:19 am
Location: Happy Valley, UT

Mon Apr 18, 2011 11:48 am

you could have avoided the whole riggamora of that thing by just stating:


$to = "$start@email.uk";

here's why it didn't work.

$email = '$start@email.uk';
This single tick blocks transformation of variables to strings in output.
Using double quotes " " will transform variables to strings in output.

$to = $email;
An un-needed, unnecessary step. creating two variables with the exact same information is ... you get the idea.

User avatar
Nullsig
php-forum Fan User
php-forum Fan User
Posts: 979
Joined: Thu Feb 17, 2011 6:52 am
Location: Racine, WI

Tue Apr 19, 2011 5:25 am

You are correct egami. But I felt teaching that "." is the method of concatenation is more important then stressing the difference in parsing between single and double quoted strings.

User avatar
egami
php-forum GURU
php-forum GURU
Posts: 2192
Joined: Wed Oct 06, 2010 11:19 am
Location: Happy Valley, UT

Tue Apr 19, 2011 7:45 am

No question or qualms there :)
I was adding to your comment, not trying to change it

User avatar
Nullsig
php-forum Fan User
php-forum Fan User
Posts: 979
Joined: Thu Feb 17, 2011 6:52 am
Location: Racine, WI

Tue Apr 19, 2011 8:18 am

Didn't mean to come across as hostile... Just wanted to state the reason for my solution to assist csf7roa in understanding what was going on.

User avatar
egami
php-forum GURU
php-forum GURU
Posts: 2192
Joined: Wed Oct 06, 2010 11:19 am
Location: Happy Valley, UT

Tue Apr 19, 2011 8:21 am

I don't take the Internet seriously..
Too many others do for me to get involved :)

User avatar
Nullsig
php-forum Fan User
php-forum Fan User
Posts: 979
Joined: Thu Feb 17, 2011 6:52 am
Location: Racine, WI

Tue Apr 19, 2011 9:18 am

Image

User avatar
egami
php-forum GURU
php-forum GURU
Posts: 2192
Joined: Wed Oct 06, 2010 11:19 am
Location: Happy Valley, UT

Tue Apr 19, 2011 10:01 am

If that guy was any more serious, he'd be cross-eyed!

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 3 guests