Thread: Seperating text

    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Quispamsis, NB, Canada
    Posts
    49
    Rep Power
    15
    I would like to know how i could seperate something, so instead of having one big thing i have to smaller things... example: take a song "Our Lady Peace - Thief" and turn it into 2 things, like:
    $artist = Our Lady Peace;
    $song = Thief;

    Is this task easily accomplished? If so can anyone show me?

    Thanks,
    Scott
  2. #2
  3. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15
    Scott,
    you can use explode() or split() function to seperate the values.

    here is an example using explode().

    <?
    $string="Our Lady Peace - Thief" ;

    $seperated_value=explode("-",$string);
    //seperate value based on '-' and put it in an array.


    $artist =$seperated_value[0];
    //Our Lady Peace

    $song = $seperated_value[1];
    //Thief

    echo $artist;
    echo $song;
    ?>

    see manual for split() function example..


    ------------------
    SR -
    webshiju.com
    www.jobxyz.com-IT Career Portal
    ezipindia.com--WebStudio


    "The fear of the LORD is the beginning of knowledge..."
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Quispamsis, NB, Canada
    Posts
    49
    Rep Power
    15
    Thanks!!
    I apprechiate the help.


    Thanks,
    Scott Lee

Similar Threads

  1. help with tables and wordwrapping
    By junkedBrian613 in forum PHP Development
    Replies: 2
    Last Post: February 15th, 2004, 06:42 PM
  2. how to keep table on top, not centered??
    By vinyl in forum HTML Programming
    Replies: 2
    Last Post: January 20th, 2004, 07:19 PM
  3. float question
    By yeah-yeah in forum HTML Programming
    Replies: 10
    Last Post: January 15th, 2004, 04:59 PM
  4. Javascript scrollbar - stuck on last bit
    By NayMyoSan in forum JavaScript Development
    Replies: 0
    Last Post: January 3rd, 2004, 01:05 PM
  5. Mouse over questions. n00b. :o
    By Not Tony Danza in forum HTML Programming
    Replies: 2
    Last Post: December 2nd, 2003, 07:28 AM

IMN logo majestic logo threadwatch logo seochat tools logo