Board index   FAQ   Search  
Register  Login
Board index PHP PHP General

working with a string..

General discussions related to php

Moderators: macek, egami, gesf

working with a string..

Postby leon » Fri Nov 01, 2002 2:12 pm

I have a problem managing a string ..

I have

$email = "test@foo.bar";

and I need to echo only "test" (excluding @foo.bar ) .

Any idea to do that :roll: ? Thank you
User avatar
leon
New php-forum User
New php-forum User
 
Posts: 36
Joined: Sat Aug 03, 2002 11:54 am

Postby Jay » Fri Nov 01, 2002 2:17 pm

A variety of methods are open to you. If you just want the user name from an email you can use:
list($user,$domain) = explode("@",$email);

$user will now be "test"
Jay
 

Postby leon » Fri Nov 01, 2002 2:23 pm

Jay wrote:A variety of methods are open to you. If you just want the user name from an email you can use:
list($user,$domain) = explode("@",$email);

$user will now be "test"


:P , Thanks Jay , you are a php guru I am loving php and this forum too !
User avatar
leon
New php-forum User
New php-forum User
 
Posts: 36
Joined: Sat Aug 03, 2002 11:54 am


Return to PHP General

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.