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.

array problem

Discussion in 'PHP' started by dizyn, Feb 16, 2008.

  1. #1
    I have following array

    Array
    (
        [0] => 9.00 => 1
        [1] => 7.00 => 1
        [2] => 3.00 => 2
    )
    Code (markup):
    i used:
    foreach($shipsz as $key => $val)
    {
    	echo "$key = $val<BR/>";
    }
    
    PHP:
    and get following output:
    0 = 9.00 => 1
    1 = 7.00 => 1
    2 = 3.00 => 2
    Code (markup):
    I want to now fetch
    9 and 1
    7 and 1
    3 and 2

    any solution
     
    dizyn, Feb 16, 2008 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    Put this in your loop:
    
    list($a, $b) = explode('.00 => ', $val);
    
    echo $a;
    echo $b;
    
    PHP:
     
    nico_swd, Feb 16, 2008 IP