Seperating A Variable Into Multiple Variables

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Twirp
Forum Newbie
Posts: 1
Joined: Sun Aug 22, 2004 9:54 pm

Seperating A Variable Into Multiple Variables

Post by Twirp »

How would i make a variable become multiple variables?
like say:
i input twirp@twirp.net
and want it to say:
hello twirp of twirp.net

My book said there's away but it didn't say how...
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

Code: Select all

<?php

$email = "twirp@twirp.net";

$email = explode("@",$email);

echo "Hello $email[0] of $email[1]";

?>
Explode will "explode" the string into different variables.
Post Reply