www.webdeveloper.com
Results 1 to 3 of 3

Thread: I suck at arrays

  1. #1
    Join Date
    Jan 2005
    Location
    USA
    Posts
    352

    I suck at arrays

    Ok, so here's the page:

    http://carbonriot.summel.net/frootloops.php

    When you click on the button, it pulls up some info.

    What I need to do is pull the first value (thru explode() or something) from each array...then put them into a new array...

    So like $images[] would = [0] => 'asdf.gif', [1] => 'this.gif'.

    How do I go about doing this? I suck at arrays, always have, always will .

    Thanks guys,
    Will

  2. #2
    Join Date
    Mar 2005
    Location
    Guayaquil - Ecuador
    Posts
    144
    well.. you won't be able to do that cause what you're retrieving thru Ajax returns the text as html (it has a <pre> tag) and not as php code..
    If you had php code with the array filled, then you could use this:
    (assumin $arr is the main array)

    PHP Code:
    foreach ($arr as $arr2) {
         
    $res=split(",",$arr2['images']);
         
    $images[]=$res[0];
    }
    print_r($images); 
    Diego Luces

  3. #3
    Join Date
    Nov 2006
    Posts
    3
    You could also use explode.
    <?php
    $a['images'] = "asdf.gif,asdf.gif,asdf.gif,asdf.gif,asdf.gif,asdf.gif,asdf.gif,asdf.gif";
    $images = explode(",",$a['images']);
    ?>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles