SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: array question

  1. #1
    SitePoint Addict
    Join Date
    Feb 2004
    Location
    Rome
    Posts
    296
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    array question

    Hello

    I have the variable

    $list

    which contains this

    Code:
    name1<br />
    name2<br />
    name3<br />
    name4<br />
    ...
    name100<br />

    I need to put on array data[$x] only the values name1,name2,name3,name4,... up to name 100.

    So at the end I need
    data[0] should return name1
    data[1] should return name2
    data[2] should return name3
    data[3] should return name4
    ...
    data[99] should return name100


    How to do that please ?
    Thank you

  2. #2
    SitePoint Wizard bronze trophy Kailash Badu's Avatar
    Join Date
    Nov 2005
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    <?php
    $list 
    "name1<br />
    name2<br />
    name3<br />
    name4<br />"
    ;

    $return explode('<br />'$list);

    print 
    "<pre>";
    print_r($return);
    print 
    "</pre>";
    ?>
    untested. need to sleep. lol

  3. #3
    SitePoint Addict
    Join Date
    Feb 2004
    Location
    Rome
    Posts
    296
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up

    thank you!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •