Hey everyone having a bit of a problem with some code i'm currently working on that i hope you can help out with.

What i am doing is running an ASP page and grabbing the string that is output by it to process in my page.

A sample return string would be:
180.0090023.34|180.009104.08|180.009204.08

Each of the products is seperated by the | character and individual items by the ^

What i want to hopefully do is create an array thats key'd on the first item ie. 180.0090

as i need to later on in my code find the price / stock levels using the itemID as the key....

Hope this makes sense,

Here is the code i currently have:

<?php
$ItemIDList= "180.0090|180.0091|180.0092";
$URL = @fopen("http://stockpricerequestweb/getlivestockprice.asp?search=$ItemIDList", "rt"); 
$ReturnString = fread($URL,9000); 
echo $ReturnString . "<br>";

$Test = explode ("|",$ReturnString);

foreach ($Test as $key => $value)
{
	$Product = explode ("^",$value);
		$LivePrice = $Product[2];
		$LiveStock = $Product[1];

}

?>

Any help/pointers would be greatly apreciated

    You could do something like this:

    $Test = explode('|', $ReturnString);
    $Products = array();
    foreach ($Test as $value)
    {
        $Product = explode('^', $value);
        $Products[$Product[0] = array(
            'LivePrice' => $Product[2],
            'LiveStock' => $Product[1]);
    }
      Write a Reply...