1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Splitting A Phrase Into Variables

Discussion in 'PHP' started by CarbonLife, Jan 26, 2010.

  1. #1
    I have a variable called open which contains an email address and a url.

    Example:
    $open = "test@domain.com http://www.bbc.co.uk";

    How do I split up $open so that the email address becomes $email, and the url becomes $url?
     
    CarbonLife, Jan 26, 2010 IP
  2. alextera

    alextera Peon

    Messages:
    20
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    If there is a space between them you can use explode.
    
    $result = explode(' ', $string);
    $email = $result[0];
    $url = $result[1];
    
    PHP:
     
    alextera, Jan 26, 2010 IP
  3. CarbonLife

    CarbonLife Guest

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanking you :)
     
    CarbonLife, Jan 26, 2010 IP