Help please :(

Discussion in 'PHP' started by rudeturk, Sep 1, 2008.

  1. #1
    I need urgent help with this,
    i have a line for example:
    28383 192.2.2.2 1919191991
    i want to break it up into 3 pieces so i could do
    $one = $match[1]; 28383
    $two = $match[2]; 192.2.2.2
    $three = $match[3]; 1919191991

    i have tried many functions such as preg_split etc but i havent managed to get it right i just get an array like
    which is just an example i made but i dont want a result like that

    Can anyone post me a php code for this please thanks in advance.
     
    rudeturk, Sep 1, 2008 IP
  2. JAY6390

    JAY6390 Peon

    Messages:
    918
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Use explode()?
     
    JAY6390, Sep 1, 2008 IP
  3. Agent_Smith

    Agent_Smith Well-Known Member

    Messages:
    890
    Likes Received:
    43
    Best Answers:
    0
    Trophy Points:
    145
    #3
    $piece = explode(" ","28383 192.2.2.2 1919191991");
    echo $piece[0];
    echo $piece[1];
    echo $piece[2];
    PHP:
     
    Agent_Smith, Sep 1, 2008 IP
    rudeturk likes this.
  4. rudeturk

    rudeturk Well-Known Member

    Messages:
    884
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    120
    #4
    Thank you so much agent smith i cant belive i didnt think of it, must have been from not sleeping lol thanks again and rep added.
     
    rudeturk, Sep 1, 2008 IP
    Agent_Smith likes this.
  5. Ilyes

    Ilyes Banned

    Messages:
    129
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
  6. JAY6390

    JAY6390 Peon

    Messages:
    918
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #6
    lol yeah that happens
     
    JAY6390, Sep 1, 2008 IP